You can use Linux du command to list directories and their total size in Linux.
List directories and their total size:
1 2 3 4 |
## List directories and their total size du --summarize --human-readable * #or du -sh * |
List and sort the output based on size:
1 2 |
## List and sort the output based on size du -sh * | sort -rh |
List directories and their total size with Linux ls command like output:
1 2 |
## ls like output with total size (du -sh ./*; ls -lh --color=no) | awk '{ if($1 == "total") {X = 1} else if (!X) {SIZES[$2] = $1} else { sub($5 "[ ]*", sprintf("%-7s ", SIZES["./" $9]), $0); print $0} }' |