How to Order by File Size Using the Du Command in Linux


If you use the du command to list all the file sizes on Linux:

du
# or
du -h # Human readable

Then you would have noticed that they are not ordered by file size.

Instead you can pass that result to the sort command as follows:

du -h | sort -h