Ubuntu – apt remove vs purge

aptpackage-managementpurge

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?

Best Answer

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