当我收到软件更新的消息并点击安装时,我收到一个"空间不足"的消息,告诉我清空垃圾桶并使用
sudo apt-get clean
命令删除临时文件。我已经清空了垃圾桶,但仍然收到相同的消息,不知道应该删除哪些临时文件,也不知道sudo apt-get clean
是什么。sudo apt-get clean
命令删除临时文件。我已经清空了垃圾桶,但仍然收到相同的消息,不知道应该删除哪些临时文件,也不知道sudo apt-get clean
是什么。sudo apt-get clean
清空本地仓库中检索到的软件包文件。它会从 /var/cache/apt/archives/
和 /var/cache/apt/archives/partial/
中删除除锁定文件之外的所有内容。
来源:man apt-get
另一种使用命令 sudo apt-get clean
查看其执行情况的可能性是通过使用 -s
选项进行模拟执行。
mook@MookPC:~$ apt-get -s clean 注意:这只是一个模拟! apt-get 需要 root 权限进行真正的执行。 还请记住锁定已禁用, 因此不要依赖于与真实当前情况的相关性! 删除 /var/cache/apt/archives/* /var/cache/apt/archives/partial/* 删除 /var/lib/apt/lists/partial/* 删除 /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin
mook@MookPC:~$ sudo apt-get -s clean [sudo] 输入 mook 的密码: 删除 /var/cache/apt/archives/* /var/cache/apt/archives/partial/* 删除 /var/lib/apt/lists/partial/* 删除 /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin感谢 @jarno 的建议。
sudo apt-get clean
无效,请尝试以下操作:sudo -i # (Allows you to execute commands with the privileges of the superuser.)
KERNELCUR=$(uname -r | sed 's/-*[a-z]//g' | sed 's/-386//g')
PKGLINUX="linux-(image|headers|ubuntu-modules|restricted-modules)"
METAPKGLINUX="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)"
KERNELSOLD=$(dpkg -l | awk '{print $2}' | grep -E "$PKGLINUX" | grep -vE "$METAPKGLINUX" | grep -v "$KERNELCUR")
apt-get purge "$KERNELSOLD" # (Remove old kernels.)
CONFOLD=$(dpkg -l | grep '^rc' | awk '{print $2}')
apt-get purge "$CONFOLD" # (Removes configuration files from deb packages that have been uninstalled.)
apt-get autoremove # (Deletes orphaned packages, or dependencies that remain installed after you have installed an application and then deleted it.)
apt-get clean # (Removes all packets from the cache.)
rm -rf /home/*/.local/share/Trash/*/** &> /dev/null # (Empty the trash from all users.)
rm -rf /root/.local/share/Trash/*/** &> /dev/null # (Empty the trash from root.)
sudo apt-get clean
和清空垃圾桶可能不会有帮助,如果你的系统有一个独立的/boot分区。 - jarno