To list all folders in a given path
this can be used
for f in ./* ; do if [ -d "$f" ]; then echo $f ; fi done;
To list sizes of all folders in a given path
To check the size of all folders in the current directory the above can be modified to use du -sh "$f" command:
for f in * ; do if [ -d "$f" ]; then du -sh "$f" ; fi done;
The command goes in a loop on every file in a current dir and if a given file is a directory, than the size is calculated.
To sort by folder size
for f in * ; do if [ -d "$f" ]; then du -s "$f" ; fi done | sort -n
Note that in du command there is no -h option!