卸载软件

Ada*_*dam 4 uninstall

有时,当我使用该sudo apt-get install <package>命令安装软件时,该软件包可能需要几分钟才能安装完毕,最终它可能会占用一些 GB 空间。如果我使用卸载它,sudo apt-get purge <package>那么它可能会在几秒钟内卸载,并且可能会从安装时占用的原始空间中删除很少的空间(一些 kb 或 mb)!显然,这意味着这不是完全卸载,并且我的电脑充满了未删除的文件。为什么会发生这种情况,我应该如何干净、完整地卸载软件包?

Wil*_*ilf 6

当你安装一个包时,它可能还需要安装依赖项才能工作 - 例如安装torcs(例如 with sudo apt-get install torcs),它需要torcs-data等等 - 它们也被安装,并且尺寸相当大(所以也需要时间下载等等)。

删除torcs(例如使用sudo apt-get remove torcs)时,它可能会将torcs-data包和其他不再需要的包留在后面,占用空间。您可以通过运行来解决这个问题sudo apt-get autoremove <package>,或者sudo apt-get autoremove在使用purge/删除它之后remove

您还可以--purge选择autoremove删除剩余的配置文件。

清除空间的另一种方法是使用sudo apt-get clean, 清除同样占用空间的 repo 信息和缓存的包。之后您可能需要运行sudo apt-get update

以下是手册页中的相关条目:

   purge
       purge is identical to remove except that packages are removed and
       purged (any configuration files are deleted too).

   clean
       clean clears out the local repository of retrieved package files.
       It removes everything but the lock file from
       /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. When
       APT is used as a dselect(8) method, clean is run automatically.
       Those who do not use dselect will likely want to run apt-get clean
       from time to time to free up disk space.

   autoremove
       autoremove is used to remove packages that were automatically
       installed to satisfy dependencies for some package and that are no
       more needed.
Run Code Online (Sandbox Code Playgroud)