How can I clean up old files within /var & /usr?

I’ve had EndeavourOS installed for about 2 years now and my install has accumulated a lot of data. I use QDirStat (it shows directory tree statistics, based off of WinDirStat) to see where the big offenders are, and it showed the following:

/var = 25.6 GB
/var/cache = 22.6 GB
/var/log = 2.4 GB

/usr = 11.4 GB
/usr/lib = 6.1 GB
/usr/share = 3.3 GB

Are there any commands to clean this up?

sudo paccache -r
sudo paccache -ruk0

Will purge your pacman cache, 1) leaving 3 latest of each installed package and 2) of programs no longer installed.

4 Likes

sudo paccache -r

==> finished: 2101 packages removed (disk space saved: 15.18 GiB)

sudo paccache -ruk0

==> finished: 163 packages removed (disk space saved: 180.56 MiB)

So, /var decreased in size by 15.32 GB which is great! But /usr stayed the same (still 11.4 GB). Is there any command to lessen space in /usr ?

You would have to dig through it in more detail to pinpoint if there is an issue in one spot. However, most of what is in /usr is installed software. You may need to remove unused software to clean that up.

Only uninstall stuff. What DE are you running? Der, was going to recommend qdirstat :blush:

XFCE

Most of the data in /usr is /usr/lib and they’re just library files (1.9 GB), the other data is /usr/share which is mostly fonts.

So, I guess there’s not much to clean there. Thanks for the help everyone!

Do you clear orphans?:

sudo pacman -Qtdq | pacman -Rns -

That may free up some space.

https://wiki.archlinux.org/title/Pacman/Tips_and_tricks#Removing_unused_packages_(orphans)

1 Like

This is a pretty good article:

1 Like

You need to make sure there’s another sudo in there or it errors out

sudo pacman -Qtdq | sudo pacman -Rns -

It did save another 185 MB though

Oops :smiley: I didn’t test… It was from memory and there ain’t nothing pre about my senility :rofl:

The first sudo is not actually needed.

2 Likes

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