I see sudo apt remove package_name and sudo apt purge package_name,
but what is the difference? is one safer than the other or does one remove packages installed by that package?

  • 1
    @daisy Very related, yes. Duplicate? No. apt and apt-get are not the same program. – Mast Jul 17 '17 at 12:49
  • 1
    @Mast but accepted answers are the same. – Winter Jul 17 '17 at 14:47
  • The duplicate candidate just got closed as a duplicate of "how do I completely remove applications" or something like that (on my phone sorry) – WinEunuuchs2Unix Jul 17 '17 at 14:53

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.


The manpage of apt-get (run man apt-get to see this) says:

    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 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.

  • 2
    apt-get is not necessarily the same as apt, as I understand from this question: askubuntu.com/questions/445384/… However in this case it doesn't make a difference. – urben Jul 16 '17 at 23:20
  • @urben Oh yeah I know. – edwinksl Jul 16 '17 at 23:21
  • Ok. 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. – urben Jul 16 '17 at 23:35
  • If you consider apt a prettier but less stable upgrade to apt-get then it could be considered a duplicate question. Can you imagine if every single question in AU about apt-get was reworded and reposted as apt? – WinEunuuchs2Unix Jul 17 '17 at 11:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.