I have recently installed Arch Linux and found that I am eating away at a lot of storage relatively quickly. For whatever reason I have already used 17GB in just about 2 weeks. I do not have a great deal of software installed so I am led to believe that all of the old packages are maintained somewhere.
To support this, I have noticed that if I installed a package, remove that package, and then re-install it that pacman merely unpacks and re-installs the software without having to re-download it.
After I installed my base system, before extra software, I used about 2GB or so maybe. I have since only installed Matlab, Skype, Wine, and a few other small programs. Of course I have also installed missing libraries and the like, but not nearly 15GB worth.
Am I completely wrong here or does Arch never delete old packages when downloading/upgrading to new versions?
If so, how do I delete these un-used packages?
Also, when I remove installed packages I use pacman -R ...
Best Answer
No, pacman doesn't remove old packages from your cache (
/var/cache/pacman/pkg
) so, over time, it can fill up.You can adopt two approaches to clearing the cache: the brute force one with
pacman -Sc
:Or, for a more nuanced approach, you can use one of the utilities that ships with pacman-contrib,
paccache
:By default,
paccache -r
will remove all but the last three versions of an installed package, but you can change this number with the-k, --keep
switch. There is also a-d, --dryrun
switch to preview your changes. You can also use the-m, --move <dir>
option to move the packages to a separate directory of your choice. Seepaccache -h
orpaccache --help
for all the switches.There are a number of utilities in the pacman-contrib package to assist with package management, it is worth looking though them all and gaining an understanding of how they work and can make running Arch much easier. You can see the full list with: