apt remove vs purge
17,157
Solution 1
You can read the manual of apt with
man apt
On line 35 you will find the following
Removing a package removes all packaged data, but leaves usually
small (modified) user configuration files behind, in case the
remove was an accident. Just issuing an installation request for
the accidentally removed package will restore its function as
before in that case. On the other hand you can get rid of these
leftovers by calling purge even on already removed packages. Note
that this does not affect any data or configuration stored in your
home directory.
So in short:
remove
leaves some config files behind where purge
does not. And you can even use purge if later you want to delete those config files.
Solution 2
The manpage of apt-get
(run man apt-get
to see this) says:
remove
remove is identical to install except that packages are removed instead of installed. Note that removing a
package leaves its configuration files on the system. If a plus sign is appended to the package name (with
no intervening space), the identified package will be installed instead of removed.
purge
purge is identical to remove except that packages are removed and purged (any configuration files are
deleted too).
In a nutshell, remove
keeps the configuration files while purge
removes them. Both are safe, but which one to pick depends on whether you want to remove configurations.
Related videos on Youtube
Author by
Camden
i write code for the fun of it and try to figure out different programs every day.
Updated on September 18, 2022Comments
-
Camden over 1 year
I see
sudo apt remove package_name
andsudo apt purge package_name
,
but what is the difference? is one safer than the other or does one remove packages installed by that package?-
Mast almost 7 years@daisy Very related, yes. Duplicate? No.
apt
andapt-get
are not the same program. -
Winter almost 7 years@Mast but accepted answers are the same.
-
WinEunuuchs2Unix almost 7 yearsThe duplicate candidate just got closed as a duplicate of "how do I completely remove applications" or something like that (on my phone sorry)
-
-
urben almost 7 years
apt-get
is not necessarily the same asapt
, as I understand from this question: askubuntu.com/questions/445384/… However in this case it doesn't make a difference. -
edwinksl almost 7 years@urben Oh yeah I know.
-
urben almost 7 yearsOk. Well I was about to mark the question as a duplicate, but since they are not necessarily the same and didn't find it the question for
apt
, I looked it up myself to check. -
WinEunuuchs2Unix almost 7 yearsIf you consider
apt
a prettier but less stable upgrade toapt-get
then it could be considered a duplicate question. Can you imagine if every single question in AU aboutapt-get
was reworded and reposted asapt
?