terminal get the size of a folder code example
Example 1: command to check size of folder in linux
du -lh --max-depth=1 --block-size=M | sort -nr
Example 2: terminal list folders with size
$ du -sh */
788K foo/
500K bar/
931K baz/
du -lh --max-depth=1 --block-size=M | sort -nr
$ du -sh */
788K foo/
500K bar/
931K baz/