Find Largest Files and directories
|
### CHEATSHEET ALL OF THESE OPERATE INTO CURRENT DIRECTORY: ### # One command, one liner per line. du -a . | sort -n -r | head -n 10 shopt -s dotglob; du -hsx * | sort -rh | head -10; shopt -u dotglob for i in G M K; do du -ah | grep [0-9]$i | sort -nr -k 1; done | head -n 11 find . -printf '%s %p\n'| sort -nr | head -10 find . -type f -printf '%s %p\n'| sort -nr | head -10 shopt -s dotglob; du -cks * | sort -rn | head; shopt -u dotglob alias ducks='shopt -s dotglob; du -cks * | sort -rn | head; shopt -u dotglob' |
I use these all the time, so I need a cheatsheet of it. Thanks NixCraft. Source of information: http://www.cyberciti.biz/faq/how-do-i-find-the-largest-filesdirectories-on-a-linuxunixbsd-filesystem/ method 1 (just using find):
|
## Warning: only works with GNU find ## find /path/to/dir/ -printf '%s %p\n'| sort -nr | head -10 find . -printf '%s %p\n'| sort -nr | head -10 |
Read More…