卸载软件

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

当你安装一个软件包时,它可能还需要安装依赖项才能工作 – 例如安装torcs (例如使用sudo apt-get install torcs ),它需要torcs-data等工作 – 它们也是安装的,并且是公平的大小(所以也需要时间下载等)。

当移除torcs (例如使用sudo apt-get remove torcs ),它可能会留下torcs-data包和其他不再需要的包,占用空间。 您可以通过运行sudo apt-get autoremove sudo apt-get autoremove解决此问题,然后使用purge / remove删除它。

您还可以使用--purge选择--purge选项来删除剩余的配置文件。

清除空间的另一种方法是使用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.