当前位置: 首页>>技术问答>>正文


“apt-get清洁”和“apt-get清洁全部”如何不同?

, ,

问题描述

如果有的话,这个命令之间的区别是什么:

sudo apt-get clean

和这个命令:

sudo apt-get clean all

在我的Lubuntu 12.04系统上,模拟这些命令显示它们的行为完全相同:

ek@Apok:~$ apt-get -s clean
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Del /var/cache/apt/archives/* /var/cache/apt/archives/partial/*
Del /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin
ek@Apok:~$ apt-get -s clean all
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Del /var/cache/apt/archives/* /var/cache/apt/archives/partial/*
Del /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin
ek@Apok:~$

apt-getcleanclean all的行为有没有区别?如果是这样,有什么区别,在什么情况下是相关的,我应该如何在两者之间进行选择?如果没有差别,那么为什么clean all存在?

如果它们相同,那么clean all仍然有意义,如果clean通常可以将包名称作为参数。但事实并非如此 – 试图将包名称传递给clean并不会改变clean的行为,整个缓存仍然会被删除:

ek@Apok:~$ apt-get -s clean nano
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Del /var/cache/apt/archives/* /var/cache/apt/archives/partial/*
Del /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin

但是,这确实让我想知道,如果clean all可能不存在(并且发生的情况是all被忽略,就像nano在上面的例子中那样)。

clean all只是一个都市传奇?

最佳解决方案

sudo apt-get clean all

all被忽略,就像你在clean后追加的任何东西一样。

例如,这也是一样的

sudo apt-get clean my room

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/783.html,未经允许,请勿转载。