What happens to old packages when I update my system?

Should I remove old version of packages to free up some space? or I just leave it be. Just curious what happen to old version of outdated packages, I mean they are still somewhere in hard drive

Theres no requirement to have them.
But people like to keep a few versions on hand - maybe just the current and last.
Also note that the package cache stores the packages compressed - so they dont take up as much space as your uncompressed filesystem.

That said … theres a tool to ‘vacuum’ :

To remove all cache, while preserving the 2 latest versions:

paccache -rvk2

To entirely remove the cache of all uninstalled packages:

paccache -rvuk0

Both pacman and pamac are configurable as to the number of cached packages kept, so you may permanently set it to any desired number as well.

PS:
I will also point out where the cache is:

/var/cache/pacman/pkg

You can use that information a number of ways … like listing the contents and ranking them by size:

du -sm /var/cache/pacman/pkg/* | sort -h
3 Likes

Oh Thank you!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.