Some Useful Pacman Commands

Created: 2019-02-01

Here are some Pacman commands that I find quite useful and that may not be known by everyone:

pacman -Qei | awk '/^Name/ { name=$3 } /^Groups/ { if ( $3 != "base" && $3 != "base-devel" ) { print name } }'

Shows all installed packages and their individual memory sizes starting with the smallest:

pacman -Qi | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -h
sudo pacman -Rsn $(pacman -Qdtq)
pacman -Qqm

Pacman stores fetched packages and does not automatically delete old or uninstalled packages. Of course, this has a few advantages:

However you should clean up this cache here and there so that it does not become infinitely large. For this there is a script called paccache. It uninstalls all stored package data of the installed and uninstalled packages except the last three. And that should normally be enough:

sudo paccache -r
sudo systemctl enable paccache.timer --now