1. The difference between apt remove purge
View man apt
apt remove: remove the package without removing the configuration file. The purpose of this is that when the package is installed again in the future, the original configuration file will be automatically loaded for use. It can also avoid deleting the package by mistake. If the configuration file is still there, reinstalling the package can restore the state of the undeleted package-without configuring the configuration file again.
apt purge: Delete the configuration file while deleting the package.
2. Delete the configuration file while deleting the package
2.1, direct apt purge
apt purge xxx
2.2, how to delete the remaining configuration files by executing apt remove first
First execute apt remove xxx
apt remove xxx
It is found that the configuration file is still there, how to completely delete the configuration file?
Just execute apt purge xxx again, and the configuration file will be cleaned up automatically. It will not affect other files in the system.
apt purge xxx
3. An example delete resolvconf
3.1, first execute apt remove and then execute apt purge
The resolvconf package is installed in order to configure DNS
apt install resolvconf
Executable file view
Configuration file view
The resolvconf package is no longer needed and I want to delete resolvconf
executed
apt remove resolvconf
Executable has been removed
but the config file still exists
Re-execute
apt purge resolvconf
The config file has been cleaned up
3.2, directly execute apt purge
Executing apt purge resolvconf directly will delete the executable file and configuration file of resolvconf together
root@debian:~# apt purge resolvconf Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages will be REMOVED: resolvconf* 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 204 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 141736 files and directories currently installed.) Removing resolvconf (1.87)... resolvconf.postrm: Reboot recommended Package configuration ┌───────────────────────────────────────────────── ────────────────────────────────────┤ Configuring resolvconf ├───────────────────── ──────────────────────────────────────────────────────────────────────────────────────────────────── ────────────┐ │ │ │ Reboot recommended │ │ │ │ The removal of the resolvconf package may have resulted in some information about name servers becoming unavailable. To correct this problem it is recommended that the system be │ │ rebooted. │ │ │ │ <Ok> │ │ │ └────────────────────────────────────────────────── ──────────────────────────────────────────────────────────────────────────────────────────────────── ──────────────────────────────────────────────────────────────────────────────────────────────────── ────────────────────────────────────────────────┘ Processing triggers for man-db (2.9.4-2) ... (Reading database ... 141718 files and directories currently installed.) Purging configuration files for resolvconf (1.87) ... root@debian:~#