Skip to content

Instantly share code, notes, and snippets.

@carlessanagustin
Last active August 16, 2017 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlessanagustin/10eed3accaca011c43ea to your computer and use it in GitHub Desktop.
Save carlessanagustin/10eed3accaca011c43ea to your computer and use it in GitHub Desktop.
Getting folder sizes through command line
# add next command to the command line
alias duf='du -sk * | sort -n | while read size fname; do for unit in k M G T P E Z Y; do if [ $size -lt 1024 ]; then echo -e "${size}${unit} - ${fname}"; break; fi; size=$((size/1024)); done; done'
# run next commands and see output
cd /
duf
# more info at http://www.carlessanagustin.com/2010/09/22/shell-como-obtener-el-tamano-de-carpeta-via-linea-de-comandos/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment