Last active
          June 1, 2017 07:51 
        
      - 
      
 - 
        
Save cybertk/4b02531350c09235f3e2d00fdbb3bbcd to your computer and use it in GitHub Desktop.  
Revisions
- 
        
cybertk renamed this gist
Jun 1, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ # Author: Quanlong <[email protected]> # Version: v20170601 # # Upgrade with curl -o https://gist.github.com/cybertk/4b02531350c09235f3e2d00fdbb3bbcd/raw/36ebae4da87ea7fe504ba58c32c81060c62e6b8d/largest list_dir_by_size() { declare dir="$1"  - 
        
cybertk created this gist
Jun 1, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ #!/usr/bin/env bash # List directories sorted by size, find largest directories # Author: Quanlong <[email protected]> # Version: v20170601 # # Upgrade with list_dir_by_size() { declare dir="$1" echo "$dir" find "$dir" -type d -depth 1 -print0 | xargs -0 du -hs | gsort -hr } usage() { echo "largest <path_of_dir>" echo "" echo "List directories sorted by size" } main() { if [[ "$1" = "--help" || "$1" = "-h" ]]; then usage exit 1 fi list_dir_by_size "${1:-$(pwd)}" } main "$@"