1、apt remove purge的区别
查看 man apt
apt remove:删除软件包,不删除配置文件。这么做的目的是将来再次安装这个包时 原来的配置文件会自动加载供使用。也可以避免误删除包,配置文件还在的话,重新安装一次软件包就可以恢复到之前未删除软件包的状态—而不用再次去配置配置文件。
apt purge:删除包的同时也删除配置文件。
2、删除包的同时删除配置文件
2.1、直接 apt purge
apt purge xxx
2.2、先执行apt remove 怎么删除剩余的配置文件
先执行了apt remove xxx
apt remove xxx
发现配置文件还在,怎么彻底删除配置文件呢?
再次执行 apt purge xxx 就可以了,会自动清理配置文件。而不会影响系统其他文件。
apt purge xxx
3、一个例子 删除resolvconf
3.1、先执行apt remove 再执行apt purge
为了配置DNS时安装了resolvconf包
apt ionstall resolvconf
可执行文件查看
配置文件查看
现在不需要resolvconf包了 想删除掉resolvconf
执行了
apt remove resolvconf
可执行文件已经删除了
但配置文件仍然存在
再执行
apt purge resolvconf
已经清理了配置文件
3.2、直接执行apt purge
直接执行apt purge resolvconf,会一起删除掉resolvconf的可执行文件和配置文件
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:~#