Linux list file & folder size, sort by size

Let’s say i have a large number of files stored in /var/www directory. How do I sort and print sizes using du -h command under Ubuntu Linux LTS version 14.04 or any other Linux distributions?

The code is :

du -h
which stand for <em>disk usage </em>and -h is <em>--human-readable</em>

To list disk usage and sort :

du -h | sort -n -r
will sort the file size by largest file first

<strong>du -h --max-depth=1 . | sort -n -r</strong>
will limit the folder depth to 1 folder only