apt purge Linux Command
Removes a package along with all its configuration files.
What does apt purge do?
Removes a package along with all its configuration files.
Syntax
apt purge package_namePractical example
sudo apt purge htopQuestions about apt purge
How do I completely remove a package?
Use `sudo apt purge package_name` to remove the package and all its configuration files from the system.
What is the difference between purge and remove?
`purge` deletes everything including config files. `remove` keeps config files so you can reinstall without losing settings.
How do I purge and remove dependencies?
Use `sudo apt purge package_name && sudo apt autoremove` to purge the package and clean up unused dependencies.
How do I purge a package that is already removed?
Use `sudo apt purge package_name` on an already-removed package to delete its remaining configuration files.
How do I see which config files will be deleted?
Use `dpkg -L package_name` to see all files installed by a package, including configuration files in /etc/.
How do I purge all old kernels?
Use `sudo apt autoremove --purge` to remove old kernels and their configuration files.
How do I clean up after purging?
Run `sudo apt autoremove` after purging to remove any leftover dependencies that are no longer needed.
How do I purge and reinstall a package?
Use `sudo apt purge package_name && sudo apt install package_name` to completely remove and reinstall with fresh config.
Related Package Management
apt removeRemoves a package but keeps its configuration files.
apt autoremoveRemoves packages that were automatically installed as dependencies and are no longer needed.
apt installInstalls one or more packages from the repository.
apt searchSearches for packages in the repository by keyword.
apt upgradeUpgrades all installed packages to their latest available versions.
apt showDisplays detailed information about a specific package.