Linux find large files with find / -type f -size +100M -exec ls -lh {} \; for a quick scan, or du -ah /path | sort -rh | head for sorted output. The team that uses ncdu has an interactive ncurses-based UI for exploring directories visually. The team that schedules a daily find job catches disk fills early.
Table of contents
- The basic find command
- With human-readable sizes
- Using du with sort
- By file age
- Interactive with ncdu
- Find by name and size
- By owner
- Removing the offenders
- FAQ
The basic find command
find / -type f -size +100M 2>/dev/null
Finds files larger than 100MB system-wide. The 2>/dev/null suppresses permission denied errors.
With human-readable sizes
find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null | awk '{print $5 "\t" $9}' | sort -rh | head -20
The team that uses this gets a sorted list of large files with sizes.
Using du with sort
du -ah /var 2>/dev/null | sort -rh | head -20
Shows the largest items in /var. The team that drills into specific directories uses this.
By file age
Find large AND old files (candidates for deletion):
find /var/log -type f -size +50M -mtime +30 2>/dev/null
The team that uses -mtime +30 finds old files safe to delete (after archival).
Interactive with ncdu
sudo apt install ncdu
sudo ncdu /
Navigate with arrow keys. Press ? for help, d to delete (with confirmation). The team that uses ncdu on servers with no GUI has visual disk exploration.
Find by name and size
find / -name "*.log" -size +50M 2>/dev/null
Finds log files larger than 50MB. The team that uses this finds runaway log files.
By owner
find / -type f -size +100M -user www-data 2>/dev/null
The team that uses this finds large files owned by specific users (useful for tracking down which app is filling the disk).
Removing the offenders
After identifying large files:
# Single file
rm /var/log/old.log
# Find results piped to rm (DANGEROUS - review first)
find / -type f -size +500M -mtime +90 -exec rm {} \;
The team that uses the find -exec rm pattern has automated cleanup. The team that uses rm -rf / is wrong.
FAQ
How do I find files over 1GB?
find / -type f -size +1G 2>/dev/null. The team that has runaway disk usage finds these quickly.
What about deleted files that are still open?
lsof | grep deleted shows open file handles pointing to deleted files (still using space until closed). The team that has ‘no files but full disk’ has this. Fix: restart the process holding the deleted file.
Can I find files by content size?
Use -size for file size on disk, not content size. The team that needs content size uses wc -c file or stat file.
How do I find the largest directories?
du -sh /* | sort -rh | head. Then drill into the largest with du -sh /var/*.
Can I exclude certain directories from find?
Yes - find / -path '/proc' -prune -o -type f -size +100M -print. The team that excludes /proc, /sys, /snap has faster scans.
If you are sizing the infrastructure for the kind of project this post covers, the RunxBuild hosting calculator is the right place to model the line items. The compute, the memory, the storage, the bandwidth, the database - each one is a separate number, and the team’s mental model for the platform is the sum of those numbers. The RunxBuild dashboard is where the team sees the actual usage in one place.
Useful related references: