Linux cleanup
Disk space matters.
Linux includes a lot of redundant files. For example, as a German - do you need man files, locales or documents in Japanese? In most cases the answer is No.
Analyze disk usage
Before cleanup, you need to know what and how much it occupies the space. These commands can help:
df -h /
- disk size, used and free space for rootdu -shx /
- total files size on the root (-x
or--one-file-system
)du -cshx /boot /usr /var
- size of specified directories (-c
or--total
)du -cshx /var/*
- sizes of directories inside the /vardu -cshx /usr/share/* | sort -h
- sizes + sorting by size
Cleanup boot
rm /boot/initramfs-linux-fallback.img
Cleanup mans
(cd /usr/share/man && find ! -path "./man*" -delete)
Get rid of mandb
systemctl disable man-db
rm -rf /var/cache/man
Cleanup locales
(cd /usr/share/locale && find ! -path "./en_US*" ! -path "./en_GB*" ! -path "./en@*" -delete)
(cd /usr/share/i18n/locales && find ! -name "POSIX" ! -name "en_US" -delete)
Cleanup docs
rm -rf /usr/share/doc
rm -rf /usr/share/info
rm -rf /usr/share/gtk-doc
Clear pacman cache
pacman -Scc