4
apt-get remove <name of program>  

apt-get purge <name of program>

and

apt-get purge -y <name of program>

Research indicates the running either "remove" or "purge" performs the exact same function and that they are interchangeable commands.

Running the command apt-get purge -y <name of program> removes the program and its dependencies.

IOW, does this command remove dependencies strictly associated with that program or is it liable to delete shared dependencies that may cause other programs to stop working?

Which should I run to delete a program? purge or purge -y ?

0

2 Answers 2

8

apt-get remove removes the package in question

apt-get purge is equivalent to apt-get remove --purge and will remove user data/configuration files.

From man apt-get:

   purge
       purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).

and

   --purge
       Use purge instead of remove for anything that would be removed. An asterisk ("*") will be displayed next to packages which are scheduled to be purged.  remove --purge is equivalent to the purge command. Configuration Item: APT::Get::Purge.

the -y flag tells the command to proceed without confirmation for trivial questions. Again, from man apt-get:

   -y, --yes, --assume-yes
       Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package, trying to install a unauthenticated package or removing an essential package occurs then apt-get will abort. Configuration Item: APT::Get::Assume-Yes.
3

The man page for apt-get has the following information -

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

Therefore, if you wish to delete all the configuration files of a particular package along with it, purge is the better option. However, if you wish to retain the configuration files, remove should be used.

   -y, --yes, --assume-yes
       Automatic yes to prompts; assume "yes" as answer to all prompts and
       run non-interactively. If an undesirable situation, such as
       changing a held package, trying to install a unauthenticated
       package or removing an essential package occurs then apt-get will
       abort. Configuration Item: APT::Get::Assume-Yes.

The -y flag does not remove dependencies but instead skips the user confirmation for the removal of the package, assuming it as a 'Yes' in the Y/N prompt.

For removing a package that is causing problems or need not be installed again, the best option is -

apt-get purge <packagename>

This is because if the configuration files for an application have been modified in a way that caused errors, purge will remove them, effectively making the subsequent install appear as a fresh install.

NOTE : The purge option does not apply to packages that hold configuration files inside the user's home folder. Refer to this answer for additional details.

Not the answer you're looking for? Browse other questions tagged .