Home / Linux / How to List All Files Ordered by Size in Linux

How to List All Files Ordered by Size in Linux

How to List All Files Ordered by Size in Linux

In certainly one of our a number of articles about itemizing information utilizing the favored ls command, we lined how to checklist and kind information by final modification time (date and time) in Linux. In this quick helpful article, we’ll current various helpful ls command choices to checklist all the information in a sure listing and kind them by file dimension in Linux.

Recommended Read: How to Find Out Top Directories and Files (Disk Space) in Linux

To checklist all information in a listing, open a terminal window and run the next command. Note that when ls invoked with none arguments, it’ll checklist the information in the present working listing.

In the next command the -l flag means lengthy itemizing and -a tells ls to checklist all information together with (.) or hidden information. To keep away from exhibiting the . and .. information, use the -A choice as an alternative of -a.

$ ls -la
OR
$ ls -la /var/www/html/admin_portal/
List All Files in LinuxList All Files in Linux

List All Files in Linux

To checklist all information and kind them by dimension, use the -S choice. By default, it shows output in descending order (greatest to smallest in dimension).

$ ls -laS /var/www/html/admin_portal/
List All Files Sort By SizesList All Files Sort By Sizes

List All Files Sort By Sizes

You can output the file sizes in human-readable format by including the -h choice as proven.

$ ls -laSh /var/www/html/admin_portal/
List Files Sort By Sizes in LinuxList Files Sort By Sizes in Linux

List Files Sort By Sizes in Linux

And to kind in reverse order, add the -r flag as follows.

$ ls -laShr /var/www/html/admin_portal/
List All Files Sort By Sizes in Reverse OrderList All Files Sort By Sizes in Reverse Order

List All Files Sort By Sizes in Reverse Order

Besides, you’ll be able to checklist subdirectories recursively utilizing the -R choice.

$ ls -laShR /var/www/html/admin_portal/
List Sub-directories RecursivelyList Sub-directories Recursively

List Sub-directories Recursively

You will even discover the next associated articles helpful:

  1. How to Find Recent or Today’s Modified Files in Linux
  2. Linux ‘tree Command’ Usage Examples for Beginners
  3. 10 Practical Examples Using Wildcards to Match Filenames in Linux
  4. Ways to Use ‘find’ Command to Search Directories More Efficiently

If you every other approach to checklist the information ordered by sizes in Linux, do share with us or do you may have questions or ideas to share about this information? If sure, attain us by way of the suggestions kind under.

About Agent

Check Also

SpaceX Successfully Launches 60 More Starlink Satellites as it Continues Towards 2020 Service Debut

SpaceX Successfully Launches 60 More Starlink Satellites as it Continues Towards 2020 Service Debut SpaceX …

Leave a Reply

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