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

Is it possible to take complete VPS backup in VPS itself?

Please note that, there is no provision to take backup of full VPS image in VPS itself. As an...

How to disable anonymous ftp in cpnael?

Note : It is not recommended to use anonymous FTP. It allows any person to access FTP without...

How to install Git on Centos7?

Git is a famous version-control system. Git is used to tracking the changes made on your code as...

The action Install for product MySQL Server 5.7.19 failed.

You may face this error while installing MySQL 5.7 or upgrading MySQL 5.6 to 5.7. Here, is the...

How to place an order for Linux VPS hosting?

Step-1: First, select your desired Linux VPS Hosting plan with your desired billing cycle...