How to List All Files Ordered by Size in Linux?

In Linux, we can list all the files using the ls command. Here, we will share some commands which will help you to sort the files in order by size.

In the following command, we will list all the files in a directory. This will also list the hidden files on that directory.

# ls -la

Here, we will use the -s option. It will list all the files in descending order (largest to smallest in size).

# ls -laS /var/log

Now, if you want to see the file size in a human-readable format, you can add -h option in the command.

# ls -laSh /var/log

If you want to sort the file with reverse order, please add r as mentioned below.

# ls -laShr /var/log

  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to install Virtualmin / Webmin control panel in Ubuntu 18.04?

Please refer to the following steps to install Webmin/Virtualmin on Ubuntu 18.04 Let's run the...

How to Enable Plaintext Authentication in Dovecot?

Dovecot is an Open source IMAP or POP3 server used to create light-weight and high-performance...

How to add IP Address on Ubuntu 18.04 using netplan?

We can configure IP Address on ubuntu 18.04 using Netplan. It is a different method to add IP...

DOS AND DON'TS FOR Linux VPS

Dos and Don'ts for Linux Classic VPS, SSD VPS, and Linux Private Cloud VPS : Please allow...

How To Add A New IP Address In Virtualmin?

You can add an IP Address via Networking Module directly with virtualmean. To do this, you need...