Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I am running out of disk space and noted that I have a large /var/cache directory. Can I safely remove this? (using Arch Linux, BTW).

share|improve this question
I'd check through what's in there, but given that's where pacman store's it's packages you might want to run pacman -Sc or even pacman -Scc if you want to clean your entire package cache. –  xenoterracide Oct 23 '11 at 20:02
Most, but not all, files under /var/cache are safe to delete. Don't delete the directories or change their ownership. Run du /var/cache/* | sort -n to see what's taking room. Ask here if you don't know whether the large directories are safe to clean. –  Gilles Oct 24 '11 at 1:14
What about a disk usage analyzer - –  Aaron Newton Jan 12 '13 at 6:28

5 Answers 5

up vote 12 down vote accepted


For one, I believe that /var/cache/bind/ is the default directory where bind9 expects its zone files to be stored (at least on Debian; I don't know offhand if other distros follow suit)

For another, according to this documentation, pacman (the package manager used by Arch linux) stores its package cache under /var/cache/pacman/pkg/ and it most likely expects nothing but itself to modify the contents.

I recommend you read through the documentation more closely and decide whether this is a good time to clear the package cache.

share|improve this answer
Yes, don't delete /var/cache/apt/archives dir, but you can delete files: /var/cache/apt/pkgcache.bin and /var/cache/apt/srcpkgcache.bin, but them will be recreated by "apt-get update". –  diyism Jun 24 '13 at 12:03
On Debian, /var/cache/bind contains zone files transferred from other nameservers—it shouldn't contain master zones. Debian follows FHS, and FHS requires that files under /var/cache be deletable. Of course, the question is about Arch, and further one shouldn't delete files without first at least figuring out what they are. –  derobert Nov 12 '13 at 22:32
That's like saying you shouldn't delete files in the temporary directory in windows without knowing what they are. If the folder is intended for temp files and your program puts non-temporary data there, then that's a huge problem for your program, not for /var/cache –  Tor Valamo Feb 18 at 1:27


Sorry for the (very) late answer, but I believe it's important to include this bit for future reference.

Highlighted the bit which does answer this question.

The /var/cache directory contains cached files, i.e. files that were generated and can be re-generated any time, but they are worth storing to save time of recomputing them.

Any application can create a file or directory here. It is assumed that files stored here are not critical, so the system can delete the contents of /var/cache either periodically, or when its contents get too large.

Any application should take into account that the file stored here can disappear any time, and be ready to recompute its contents (with some time penalty).

So yes, you may remove these files without expecting anything bad to happen.

share|improve this answer
You will have to jump through some hoops if you delete /var/cache and want to use apt afterwards. –  Matthias Braun Mar 6 '14 at 21:56
@MatthiasBraun if you have to jump through hoops, then maybe apt is breaking some conventions and should reconsider their approach. –  Tor Valamo Aug 23 at 16:08
But Matthias is right. Just recently, network-manager v1.0.4 made my network inaccessible. (Known bug) That means, even to fix some things, I was instantly unable to fetch any packages from the internet to repair the stuff. But /var/cache/apt/archives saved my life! Used dpkg with the pre-1.0 version of network-manager that was found there, and I was back in the WWW world! So think twice before removing anything in there. –  syntaxerror Sep 20 at 8:43
@syntaxerror that doesn't mean anything for the question, which was, does it matter for any applications if /var/cache is deleted. The answer is still no. It mattered for you that you hadn't deleted it, but for apt it shouldn't matter for it to still work if you do. That you had network issues doesn't have anything to do with the question. –  Tor Valamo Sep 22 at 21:53
Why does it need to?---Anyways, I was directly nodding to what Matthias said about "hoops", i. e. difficulties, if you choose to delete /var/cache/apt/* and you're using APT at the same time. Though I would not be keen on testing it out :), I am sure (just like Matthias is) that APT would no longer work flawlessly once /var/cache/apt/* gets entirely purged. However, I do accept evidence which proves the contrary. And no, vague presumptions like "it shouldn't matter if" will not count. :p –  syntaxerror Sep 23 at 7:10

You can make this determination yourself using lsof.

Run lsof -Pn +D /var/cache/ | awk '{print $1}' | sort | uniq to see which software currently has any open files in that directory. If anything looks moderately important (or you dont know what it is) then do not remove it.

Besides, you shouldn't be just blowing out directories without backups anyways; this even applies to /tmp.

share|improve this answer

As others have said, /var/cache/ can be used by any application to store information to save on retrieval time. In my experience though, most of the space taken up in there is from the system's package manager.

From the Arch Linux wiki:

pacman stores its downloaded packages in /var/cache/pacman/pkg/ and does not remove the old or uninstalled versions automatically, therefore it is necessary to deliberately clean up that folder periodically to prevent such folder to grow indefinitely in size.

pacman -Sc

However, unless storage space is a desperate issue, to save headache later, in the cause of a future incompatibility; one of these other tools should be utilized: paccache, pkgcacheclean, or pacleaner.

For other system:

Redhat based (Fedora, CentOS, SL, ...)

yum clean all
# or
dnf clean all

Debian based (Ubuntu, ...)

apt-get autoclean

SUSE based

zypper clean
share|improve this answer

Use the apt-get to clean up the local repository:

sudo apt-get clean

share|improve this answer
Arch doesn't use apt –  Michael Mrozek Nov 12 '13 at 21:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.