Deleting files found by find is irreversible. Always run with -print or -ls first. Never find / -delete unless you hate your career.
What you will achieve
Locate large files from the shell on Ubuntu and Debian without needing ncdu — prune paths, sort by size, and remove or archive safely.
1) Find files over 100 MB
sudo find /var -xdev -type f -size +100M -print 2>/dev/null
-xdev stays on one filesystem — avoids crossing into NFS or proc. Adjust threshold: +1G for gigabyte hunters, +500M for finer nets.
2) Show size with find and du
sudo find /var/log -type f -size +50M -exec du -h {} + 2>/dev/null | sort -h
-exec du -h {} + batches efficiently. Sorted output puts the worst offenders at the bottom.
3) Top ten largest under a path
sudo find /home -xdev -type f -printf '%s %p\n' 2>/dev/null | \
sort -n | tail -10 | awk '{printf "%.1f MB %s\n", $1/1024/1024, $2}'
GNU find on Debian/Ubuntu supports -printf for byte-accurate sorting without spawning du per file.
4) Exclude noise paths
sudo find / -xdev -type f -size +500M \
! -path '/proc/*' ! -path '/sys/*' ! -path '/dev/*' \
-print 2>/dev/null
Prune pseudo-filesystems and snapshot directories you must not touch.
5) Find old large logs
sudo find /var/log -type f -name '*.log' -size +100M -mtime +30 -ls
-mtime +30 means not modified in 30 days. Truncate or rotate via logrotate rather than blind deletion on active logs.
6) Safe deletion workflow
# Step 1: list only
sudo find /tmp -type f -size +1G -print
# Step 2: after review
sudo find /tmp -type f -size +1G -print -delete
Prefer truncate -s 0 huge.log on active logs over deletion. Move to archive before remove on anything uncertain.
7) When find is slow
sudo du -ah /var | sort -h | tail -20
du summarises directories; combine with targeted find once you know the heavy subtree.
Verify
df -h /var
sudo find /var -xdev -type f -size +1G | wc -l
Large-file count should drop after cleanup; confirm services still start and logs still write.