ubuntu 释放缓存_如何通过删除缓存的程序包文件在Ubuntu Linux上释放大量磁盘空间...
ubuntu 释放缓存
If you’re anything like me, you probably have Ubuntu running on your older computers, and they often have smaller hard drives so you’re looking to save every bit of drive space you can. Here’s an easy trick to free up a surprising amount of drive space.
如果您像我一样,则可能是在较旧的计算机上运行Ubuntu,并且它们通常具有较小的硬盘驱动器,因此您希望节省所有的驱动器空间。 这是一个释放大量驱动器空间的简单技巧。
Every time Ubuntu updates or you install some software, the package manager downloads all of the packages to the system, and then caches them there in case they need to be installed again. Unfortunately, this can often mean a real lot of wasted space.
每次Ubuntu更新或您安装某些软件时,软件包管理器都会将所有软件包下载到系统中,然后将其缓存在该处,以防需要再次安装。 不幸的是,这通常意味着大量浪费的空间。
检查缓存文件使用的驱动器空间 (Check the Drive Space Used by Cached Files)
To check out the used space for yourself, head into the /var/cache/apt/archives folder, or just run the following command from the prompt:
要自己检查已用空间,请转至/ var / cache / apt / archives文件夹,或从提示符处运行以下命令:
du –sh /var/cache/apt/archives
du –sh / var / cache / apt / archives
You’ll see that there’s a lot of space being used—on this testing box, which I’ve barely used, there’s 441 MB sitting there in the cache folder.
您会看到有很多空间正在使用,在这个我几乎没用过的测试盒上,缓存文件夹中有441 MB的空间。
清理缓存的软件包 (Clean Out the Cached Packages)
To clean out this folder properly, you can use this command from the shell prompt:
要正确清理此文件夹,可以在shell提示符下使用以下命令:
sudo apt-get clean
须藤apt-get clean
You could, of course, delete the files manually if you wanted to, but that would probably be a mistake since the lock file and the blank partial directory are supposed to stay there—and it’s less keystrokes to type this anyway.
当然,您可以根据需要手动删除文件,但这可能是一个错误,因为应该将锁定文件和空白的部分目录保留在该目录中,并且无论如何键入此键都较少。
禁用自动程序包缓存 (Disable Automatic Package Caching)
If you’d rather not have to go in and clean out the cache folders all the time, you can tell Ubuntu to stop keeping them around with a simple configuration change. Head into System –> Administration –> Synaptic Package Manager.
如果您不想一直去清理缓存文件夹,可以告诉Ubuntu通过简单的配置更改就停止保留它们。 进入系统–>管理–> Synaptic软件包管理器。
Then choose Settings –> Preferences
然后选择设置–>首选项
Switch over to the Files tab, where you can change the option to “Delete downloaded packages after installation”, which will prevent the caching entirely.
切换到“文件”选项卡,您可以在其中将选项更改为“安装后删除下载的软件包”,这将完全阻止缓存。
You’ll also notice that you can use the Delete Cached Package Files button from this screen to clean up the packages.
您还将注意到,可以使用此屏幕上的“删除缓存的软件包文件”按钮来清理软件包。
ubuntu 释放缓存