scan-hidden-dirs-before-cleanup
Systematically identify and recover space from hidden directories before aggressive disk cleanup.
Scan Hidden Directories Before Cleanup
When your disk is running critically low on space, hidden directories often contain the largest recoverable amounts of data. Before deleting important files, scan these locations first.
Why This Matters
Hidden directories like .git, .cache, node_modules, and service workers can consume gigabytes of space but are easy to overlook. Identifying them first lets you make informed decisions about what to delete.
Steps
Scan hidden directories for size
- Run:
du -sh ~/.*to see hidden directories in your home folder - Run:
du -sh ~/Library/Caches/*to check cache directories (Mac) - Run:
find ~ -name "node_modules" -type d -exec du -sh {} \;to find large dependency folders
- Run:
Check development artifacts
- Look for
.gitdirectories in projects:find ~ -name ".git" -type d -exec du -sh {} \; - Check build directories:
.next,.build,dist,build - Scan for service worker caches in browser folders
- Look for
Prioritize by size
- Sort results by space usage
- Target the largest directories first for maximum impact
Clean strategically
- Delete caches and build artifacts (usually safe to regenerate)
- Archive old
.githistories if needed - Remove unused
node_modulesfrom abandoned projects
Tips
- Use
ncdu(NCurses Disk Usage) for an interactive directory browser - Always verify what you're deleting before running
rm -rf - Consider archiving instead of deleting valuable development history
- Hidden files start with
.and are hidden by default in most file explorers