Cleanup unused files in Linux
Keep at least 10% of drive space to avoid:
- SSD wear
- HDD fragmentation
Determine free space on Linux / macOS / Windows Subsystem for Linux with “ncdu”.
ncdu uses Ncurses terminal graphics to quickly show the biggest files in the Linux filesystem tree.
ncdu is very handy to find large files or directories under the ~
you may not need anymore.
df -h
gives a drive-level summary of disk usage.
There are a few categories of files that are cached on a Linux system. On embedded systems where eMMC or an SD card is used, it’s easy to use all available space. The package installation system caches installed files in case of need to reinstall, but this is a rare need. Clear the package cache:
apt autoclean
# or
dnf clean all
One of the largest directories on my PC was for TeXlive documentation.
Using Synaptic, I highlighted everything using search term texlive-doc
.
This also removes texlive-full
but with no detriment to texlive working.

Packages removed for texlive-doc to save over 1 GB of disk space.
Related: Find largest directory