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
ls to checklist all information together with
(.) or hidden information. To keep away from exhibiting the
.. information, use the
-A choice as an alternative of
$ ls -la OR $ ls -la /var/www/html/admin_portal/
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/
You can output the file sizes in human-readable format by including the
-h choice as proven.
$ ls -laSh /var/www/html/admin_portal/
And to kind in reverse order, add the
-r flag as follows.
$ ls -laShr /var/www/html/admin_portal/
Besides, you’ll be able to checklist subdirectories recursively utilizing the
$ ls -laShR /var/www/html/admin_portal/
You will even discover the next associated articles helpful:
- How to Find Recent or Today’s Modified Files in Linux
- Linux ‘tree Command’ Usage Examples for Beginners
- 10 Practical Examples Using Wildcards to Match Filenames in Linux
- 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.