4

I've just realised I'm not sure how to perform a purge with Apt, that will purge all the dependencies too. I'm reading here and there and still unsure have these candidates:

apt purge --auto-remove <packagename>

and (after purging some packages first):

apt autoremove --purge

Are they correct? Equivalent? Is there a better way?

0
11

They’re both correct, but not quite equivalent.

apt purge --auto-remove <packagename>

purges packagename and any packages which are rendered unnecessary by its removal, as well as any other packages which aren’t necessary.

apt autoremove --purge

purges any packages which aren’t necessary (marked as “automatically installed” and with no dependent packages).

The first form is what you’d use when manipulating individual packages; the latter is a clean-up operation across all packages.

You could also enable APT::Get::AutomaticRemove in your apt configuration to get apt to always auto-remove (or use aptitude which behaves like that by default).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy