apt-get remove <name of program>
apt-get purge <name of program>
和
apt-get purge -y <name of program>
研究表明,运行“删除”或“清除”执行的功能完全相同,并且它们是可互换的命令。
运行该命令apt-get purge -y <name of program>
将删除该程序及其依赖项。
换句话说,这个命令是否会删除与该程序严格关联的依赖项,或者是否会删除可能导致其他程序停止工作共享依赖项?
我应该运行哪一个来删除程序?purge
或purge -y
?
答案1
apt-get remove
删除有问题的包
apt-get purge
等同于apt-get remove --purge
并将删除用户数据/配置文件。
从man apt-get
:
purge purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).
和
--purge Use purge instead of remove for anything that would be removed. An asterisk ("*") will be displayed next to packages which are scheduled to be purged. remove --purge is equivalent to the purge command. Configuration Item: APT::Get::Purge.
该-y
标志指示命令继续执行,而无需确认琐碎的问题。再次引用man apt-get
:
-y, --yes, --assume-yes Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package, trying to install a unauthenticated package or removing an essential package occurs then apt-get will abort. Configuration Item: APT::Get::Assume-Yes.
答案2
的手册页apt-get
包含以下信息 -
remove
remove is identical to install except that packages are removed
instead of installed. Note that removing a package leaves its
configuration files on the system. If a plus sign is appended to
the package name (with no intervening space), the identified
package will be installed instead of removed.
purge
purge is identical to remove except that packages are removed and
purged (any configuration files are deleted too).
因此,如果您希望删除某个包的所有配置文件,则purge
最好使用 。但是,如果您希望保留配置文件,remove
则应使用 。
-y, --yes, --assume-yes
Automatic yes to prompts; assume "yes" as answer to all prompts and
run non-interactively. If an undesirable situation, such as
changing a held package, trying to install a unauthenticated
package or removing an essential package occurs then apt-get will
abort. Configuration Item: APT::Get::Assume-Yes.
该-y
标志不会删除依赖项,而是跳过用户对删除包的确认,假定在 Y/N 提示中回答“是”。
要删除导致问题或不需要再次安装的软件包,最好的选择是 -
apt-get purge <packagename>
这是因为,如果应用程序的配置文件被修改并导致了错误,purge
则会删除它们,从而使后续安装看起来像是全新安装。
注意:此purge
选项不适用于在用户主文件夹中保存配置文件的软件包。请参阅这个答案了解更多详细信息。