Last active
August 16, 2017 13:57
-
-
Save carlessanagustin/10eed3accaca011c43ea to your computer and use it in GitHub Desktop.
Getting folder sizes through command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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