Ubuntu – How to list the size of a directoy and subdirectories and files inside it by terminal

command linedirectoryfiles

Is there a command to list a directory total size and then each sub-folder and files inside it .

I also want to sort them by increasing order so that I can see which folder is greater in size.

Best Answer

du -sh * | sort -h

will get you a human-readable ascending list of the sizes of files and subdirectories in your current directory,

du -sh 

will summarize the current directory size.