apt-get purge: Remove a package and its configuration files
August 9th, 2024 12:42 PM Mr. Q Categories: Command
Command: apt-get purge
Used to completely remove a package along with its configuration files from your system. This command is more thorough than apt-get remove
as it also deletes configuration files associated with the package.
Sample Command and Output:
$ sudo apt-get purge vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
vim vim-common vim-runtime xxd
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
After this operation, 11.0 MB of disk space will be freed.
Do you want to continue? [Y/n]
Description:
sudo apt-get purge <package_name>
: Completely removes the specified package (vim
in this example) along with its configuration files. It also lists any additional packages that will be removed as a result. The command frees up disk space by removing all related files.
Additional Commands and Sample Outputs:
apt-get purge <package_name> --auto-remove
: Remove the package, its configuration files, and automatically remove packages that were installed as dependencies but are no longer needed. Sample Command and Output:
$ sudo apt-get purge --auto-remove vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
vim vim-common vim-runtime xxd
The following packages will be automatically removed:
vim-gtk vim-tiny
0 upgraded, 0 newly installed, 4 to remove and 2 to auto-remove.
After this operation, 15.0 MB of disk space will be freed.
Description:
apt-get purge <package_name> --auto-remove
: Removes the package and its configuration files, and also removes any unused packages that were installed as dependencies.apt-get purge --dry-run <package_name>
: Simulate the removal of a package and its configuration files without making any changes. Sample Command and Output:
$ sudo apt-get purge --dry-run vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages would be REMOVED:
vim vim-common vim-runtime xxd
Description:
apt-get purge --dry-run <package_name>
: Displays what would be removed if the command were executed, without actually performing the removal. Useful for previewing changes.
Note: Use apt-get purge
when you want to ensure that all configuration files and related data are completely removed from your system, freeing up additional disk space.