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.

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.

One Comment

  1. Thanks for sharing the useful information for sorting files using LS command. My favorite is -halt with ls command. Here you find a few examples of how to sort files by date using LS command in Linux, I hope this might be a great fit for your readers.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.