Here's the cleanup guide:
Safe to run anytime. Nothing here deletes personal files or system-critical data.
df -hLook at the Use% column for / (root). If it's above 85%, proceed.
sudo apt-get autoremove -y && sudo apt-get autoclean -yRemoves orphaned packages and old cached .deb files.
Snap keeps old versions around unnecessarily.
# Limit snap to keep only 2 revisions going forward
sudo snap set system refresh.retain=2
# Remove all currently disabled (old) revisions
sudo snap list --all | awk '/disabled/{print $1, $3}' | while read snapname revision; do
sudo snap remove "$snapname" --revision="$revision"
done
⚠️ This only removes old versions — your current snap apps are unaffected.
npm cache clean --forceSafe to clear anytime. npm rebuilds it as needed.
rm -rf ~/.local/share/Trash/*These are all auto-regenerated by their tools:
rm -rf \
~/.cache/pnpm \
~/.cache/typescript \
~/.cache/gopls \
~/.cache/prisma \
~/.cache/ms-playwright-go \
~/.cache/node-gyp \
~/.cache/pip \
~/.cache/hardhat-nodejs \
~/.cache/staticcheck \
~/.cache/goimports \
~/.cache/thumbnails \
~/.cache/tracker3
⚠️ Skip any entries that don't apply to your stack. All are safe to delete.
Keeps only logs from the last 7 days:
sudo journalctl --vacuum-time=7ddf -h /Compare Avail before and after.
Find what's eating space before deleting anything:
# Top-level home directory sizes
du -sh ~/* 2>/dev/null | sort -rh | head -20
# Snap data breakdown
du -sh ~/snap/*/ 2>/dev/null | sort -rh
# Cache breakdown
du -sh ~/.cache/* 2>/dev/null | sort -rh | head -15
# Downloads folder
du -sh ~/Downloads/* 2>/dev/null | sort -rh | head -20These require human judgment — do not auto-delete:
| Path | Typical Size | Action |
|---|---|---|
~/Downloads/ |
Varies | Delete files you no longer need |
~/snap/firefox/ |
2–4 GB | Keep unless switching to deb/flatpak |
~/snap/discord/ |
1–2 GB | Keep unless unused |
~/.npm/ |
2–6 GB | Safe to clear (Step 4 above) |
| Step | Typical Savings |
|---|---|
| APT cleanup | 100–500 MB |
| Old snap revisions | 500 MB – 3 GB |
| npm cache | 2–6 GB |
| Trash | Varies |
| Dev caches | 500 MB – 2 GB |
| Journal logs | 200–500 MB |
| Total | ~4–12 GB |