Blog » Linux Commands » Sort files size using ls command in Linux

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

1 thought on “Sort files size using ls command in Linux”

  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 Comment

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