find "$SEARCH_DIR" -type f -printf '%s\t%p\n'
find "$SEARCH_DIR" -type f -printf '%s\t%p\n'
find "$SEARCH_DIR" -type f -printf '%s\t%p\n'
\( -path /proc -o -path /sys -o -path /dev -o -path /run -o -path /snap \) -prune
\( -path /proc -o -path /sys -o -path /dev -o -path /run -o -path /snap \) -prune
\( -path /proc -o -path /sys -o -path /dev -o -path /run -o -path /snap \) -prune
2>/dev/null
2>/dev/null
2>/dev/null
sudo ./find_largest_files.sh / 50 full_scan.txt
sudo ./find_largest_files.sh / 50 full_scan.txt
sudo ./find_largest_files.sh / 50 full_scan.txt
./find_largest_files.sh ~/mortgage_system 30 mortgage_system_report.txt
./find_largest_files.sh ~/mortgage_frontend 30 mortgage_frontend_report.txt
./find_largest_files.sh ~/mortgage_system 30 mortgage_system_report.txt
./find_largest_files.sh ~/mortgage_frontend 30 mortgage_frontend_report.txt
./find_largest_files.sh ~/mortgage_system 30 mortgage_system_report.txt
./find_largest_files.sh ~/mortgage_frontend 30 mortgage_frontend_report.txt
du -h --max-depth=1 ~/mortgage_system | sort -rh | head -20
du -h --max-depth=1 ~/mortgage_frontend | sort -rh | head -20
du -h --max-depth=1 ~/mortgage_system | sort -rh | head -20
du -h --max-depth=1 ~/mortgage_frontend | sort -rh | head -20
du -h --max-depth=1 ~/mortgage_system | sort -rh | head -20
du -h --max-depth=1 ~/mortgage_frontend | sort -rh | head -20
du -sh ~/mortgage_system/node_modules ~/mortgage_frontend/node_modules 2>/dev/null
du -sh ~/mortgage_system/node_modules ~/mortgage_frontend/node_modules 2>/dev/null
du -sh ~/mortgage_system/node_modules ~/mortgage_frontend/node_modules 2>/dev/null
# Overall disk usage at a glance
df -h # Top-level directories sorted by size (run from /)
sudo du -h --max-depth=1 / 2>/dev/null | sort -rh | head -20 # What's eating your home directory
du -h --max-depth=1 ~ | sort -rh | head -20 # Docker-specific
docker system df
docker system prune -a --volumes # aggressive, frees everything unused # Clean npm cache
npm cache clean --force # Clean pip cache
pip cache purge # Clear systemd journal older than 7 days
sudo journalctl --vacuum-time=7d
# Overall disk usage at a glance
df -h # Top-level directories sorted by size (run from /)
sudo du -h --max-depth=1 / 2>/dev/null | sort -rh | head -20 # What's eating your home directory
du -h --max-depth=1 ~ | sort -rh | head -20 # Docker-specific
docker system df
docker system prune -a --volumes # aggressive, frees everything unused # Clean npm cache
npm cache clean --force # Clean pip cache
pip cache purge # Clear systemd journal older than 7 days
sudo journalctl --vacuum-time=7d
# Overall disk usage at a glance
df -h # Top-level directories sorted by size (run from /)
sudo du -h --max-depth=1 / 2>/dev/null | sort -rh | head -20 # What's eating your home directory
du -h --max-depth=1 ~ | sort -rh | head -20 # Docker-specific
docker system df
docker system prune -a --volumes # aggressive, frees everything unused # Clean npm cache
npm cache clean --force # Clean pip cache
pip cache purge # Clear systemd journal older than 7 days
sudo journalctl --vacuum-time=7d
sudo apt install ncdu
ncdu ~
sudo apt install ncdu
ncdu ~
sudo apt install ncdu
ncdu ~
# Edit your crontab
crontab -e # Add: run every Sunday at 2 AM, save to a reports directory
0 2 * * 0 /home/you/find_largest_files.sh / 50 /home/you/disk_reports/scan_$(date +\%Y\%m\%d).txt
# Edit your crontab
crontab -e # Add: run every Sunday at 2 AM, save to a reports directory
0 2 * * 0 /home/you/find_largest_files.sh / 50 /home/you/disk_reports/scan_$(date +\%Y\%m\%d).txt
# Edit your crontab
crontab -e # Add: run every Sunday at 2 AM, save to a reports directory
0 2 * * 0 /home/you/find_largest_files.sh / 50 /home/you/disk_reports/scan_$(date +\%Y\%m\%d).txt - Takes three optional arguments: search directory, number of results, and output filename.
- Validates that the search directory exists and that the count is a positive integer.
- Writes a header to the output file with timestamp, host, user, and scan parameters.
- Uses find to list every regular file under the target directory, along with its size in bytes.
- Sorts the list numerically by size (largest first), takes the top N, and converts byte counts into human-readable units (K/M/G/T).
- Appends the formatted list to the report and prints it to your terminal. - node_modules/ — routinely 500 MB to 2 GB per project. Two full Next.js/React projects with heavy dependency trees can easily account for 3–5 GB each.
- .next/ or dist/ or build/ — production builds and incremental build caches. Next.js's .next/cache in particular can grow to several GB over weeks of npm run dev.
- .git/ — if you've committed large binaries or have a long history, .git/objects can be surprisingly fat. git gc --aggressive helps.
- Python __pycache__/ and .venv/ — virtual environments with ML/data dependencies (torch, tensorflow, pandas) are often 3–8 GB each.
- Docker layers — /var/lib/docker is the single most common "where did my disk go?" answer on dev machines. docker system df shows the breakdown; docker system prune -a reclaims it.
- Log files — /var/log/journal/, application logs, and PM2 logs can grow indefinitely if no rotation is configured.
- Snap revisions — Ubuntu keeps old snap versions by default. sudo snap set system refresh.retain=2 caps retention at two revisions.
- Trash — ~/.local/share/Trash/ is easy to forget.
- Browser caches — ~/.cache/google-chrome, ~/.cache/mozilla, and similar can hit several GB. - GNU findutils manual — find — authoritative reference for find, including the full -printf format spec.
- Linux du man page — directory-aggregate sizing, the natural complement to this script.
- Linux df man page — filesystem-level free space.
- ncdu home page — interactive disk usage analyzer.
- Docker: prune unused objects — official guide to reclaiming Docker space.
- npm cache documentation — how npm's cache works and how to clean it.
- Ask Ubuntu: Why is my disk full? — community thread with many alternative one-liners.
- Arch Wiki: Disk usage analyzers — concise overview of CLI and GUI tools across the Linux ecosystem.