Compact Directory Listing Commands
Problem
The classic DIY tree command (find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g') outputs too much — shows every file including hidden metadata folders like .git and node_modules.
Solution: Progressive Filtering
Option 1: Use tree (Recommended)
tree -I 'node_modules|.git|cache' -L 2Option 2: Ultra-Compact find
find . -maxdepth 2 -not -path '*/.*' \
\( -name "node_modules" -o -name "bin" -o -name "obj" -o -name "venv" -o -name "target" \) -prune \
-o -type d -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' | tee project_summary.txtKey flags:
-maxdepth 2— Level 2 gives the “map,” Level 3 gives the “census”-prune— stopsfindfrom entering heavy directories (not just hiding names)-not -path '*/.*'— hides hidden files/folders (90% of clutter)tee— displays on screen AND saves to file
Option 3: Summary View (No Tree)
du -h --max-depth=1 | sort -hShows which folders consume the most space — useful for identifying clutter sources.
Related
- terminal-workflow-optimization — Terminal environment setup
- ansi-escape-sequences — Terminal output formatting