- 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
.
from https://forum.manjaro.org/t/cleaning-up-and-freeing-disk-space/6703/31?page=2
Using -mtime does:
find ~/.cache -depth -type f -mtime +100 -delete While we’re at it, here’s my housekeeping stuff. I keep it in a shell script that can be run all at once for convenience, but it’s also around for reference if I only want to perform a specific task.
sudo journalctl --vacuum-size=500M && sudo journalctl --vacuum-time=7d
sudo paccache -rvuk0
sudo paccache -rvk3
yay -Sc -a
pamac clean -bv
rm -rf ~/{.bundle,.cargo,.cmake,.dotnet,.electron,.electron-gyp,.gem,.gradle,.lazarus,.node-gyp,.npm,.nuget,.nvm,.racket,.rustup,.stack,.yarn} || true rm -rf ~/.cache/{electron,electron-builder,go-build,node-gyp,pip,yarn} || true sudo rm -rf ~/go || true
sudo lostfiles I have a Pacman hook for detecting orphans:
/etc/pacman.d/hooks/orphans.hook [Trigger] Operation = Install Operation = Upgrade Operation = Remove Type = Package Target = *
[Action] Description = Checking for orphaned packages... When = PostTransaction Exec = /usr/bin/bash -c "/usr/bin/pacman -Qtd || /usr/bin/echo '=> No orphans found.'"