- Clean pkg cache
- Remove unused packages (orphans)
- Clean cache in /home
- remove old config files
- Find and Remove
- duplicates
- empty files
- empty directories
- broken symlinks
- Find Large files
List packages
ls /var/cache/pacman/pkg/ | less
Remove all pkg except those installed
sudo pacman -Sc
Remove all files
sudo pacman -Scc
Download manually from archive.
sudo pacman -S pacman-contrib
Remove
paccache -r
Systemd timer
create file in /etc/systemd/system/paccache.timer
with the following contents
[Unit]
Description=Clean-up old pacman pkg cache
[Timer]
OnCalendar=monthly
Persistent=true
[Install]
WantedBy=multi-user.target
Enable by sudo systemctl start paccache.timer
Pacman post-transaction hook
List unused
sudo pacman -Qtdq
Remove unused
sudo pacman -R $(pacman -Qtdq)
cache is located in ~/.cache
stored in ~/.config/
install rmlint package sudo pacman -S rm lint
.
Another recommendation if you want remove large/orphans packages:
https://wiki.archlinux.org/title/Pacman/Tips_and_tricks#Listing_packages
https://wiki.archlinux.org/title/Pacman/Tips_and_tricks#Removing_unused_packages_(orphans)
Edit:
About home .cache normally there are no problems to delete this, but a good practice would not delete only the old caches?...:
# find ~/.cache/ -type f -atime +30 -delete
About home .config: If you use VSCode don't do it without careful.