Sort files size using ls command in Linux

ls command is used to lists all files/folders in Linux. The default output does not sort the files by size.

WHMCS Complete Billing and Support

To sort the files by size, you need to pass -s or –sort=size option as follow:

$ ls -s
$ ls –sort=size

If you wish to sort particular extension by size, you can use as follow:

$ ls –sort=size *.jpg
$ ls -s *.jpg

Posted in Linux Commands.

Leave a Reply

Your email address will not be published. Required fields are marked *