Pacman
Installing packages
$ pacman -S package_name
Removing packages
$ pacman -R package_name
$ pacman -Rs package_name
Remove all uninstalled package $ sudo pacman -Sc
Cache
Get the number of package
$ sudo ls /var/cache/pacman/pkg/ | wc -l
Get the size it take on disk
$ du -sh /var/cache/pacman/pkg/
Remove packages keeping 3 downgrade versions
$ sudo paccache -r
List package by size
LC_ALL=C pacman -Qi | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -h
Hooks
Create a file /etc/pacman.d/hooks/clean_package_cache.hook
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = *
[Action]
Description = Cleaning pacman cache...
When = PostTransaction
Exec = /usr/bin/paccache -r
Rollback
Listing packagaes
List packages installed from the arch repository.
pacman -Qnq
List packages installed from the AUR.
pacman -Qqem
Invalid / corrupted packages
pacman -Sy archlinux-keyring