What is the difference between apt-get remove and purge and autoremove in Ubuntu?

What is the difference between apt-get remove and purge and autoremove in Ubuntu?
Difference between apt-get remove and purge and autoremove in Ubuntu?


Let’s explain this by taking php package as the one to be removed.

purge

sudo apt-get purge php

This removes the package as well as its configuration files. But the dependencies will remain in the system. However, configuration files in the home directory won’t get removed.

This command is the same as using –purge option with the above remove command.

remove

sudo apt-get remove php

This removes the PHP binaries, but it’s configuration files and installed dependencies will remain in the system.

autoremove

sudo apt-get autoremove php

This will remove  the package as well as its dependencies, if those dependencies aren’t used by other packages.

sudo apt-get automove

If the package name is not specified with autoremove, it will remove all the unused dependencies in the system.

Leave a Reply

Your email address will not be published.