« Back to Package manager: Frequently Asked Questions

How to remove a package with apt?

How to remove a package with apt?

Run apt with the 'remove' subcommand, optionally followed by 'apt purge' to remove any configuration file or directories that may be left over.

apt autoremove

The opposite of installing a package is using apt with the remove subcommand. It will remove any defined file or directory that is available in the package listing. Any changes to files on this list will be left alone, so that you won’t lose them. This is useful when reinstalling a package. Same applies for directories that are not empty or that contain files added later, for example by the system administrator.

apt remove PACKAGE

Run apt command with the purge subcommand to remove all files and do a full clean of a package and its previously installed files.

apt purge PACKAGE

Learn more about apt

This article uses the apt command to achieve its tasks. For this popular tool there is a cheat sheet available!

» Mastering the tool: apt

apt cheat sheet

Other questions related to Package manager

    Related articles

    Like to learn more? Here is a list of articles within the same category or having similar tags.

    Feedback

    Small picture of Michael Boelen

    This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

    Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!

    Mastodon icon