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
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.