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 NEXTCLOUD ON UBUNTU?

Nextcloud is an open-source and secure PHP-based content collaboration platform. It is used for...

How to Install SHOUTCast Radio Server on Linux VPS?

This tutorial will assist you to install SHOUTcast Distributed Network Audio Server (DNAS 2.0) in...

How to upgrade Debian 7 (Wheezy) to 10 (Buster) version?

It is always recommended to upgrade the version to prevent any security vulnerability. You can...

How to set File Upload Size limit in Apache?

As we know Apache is an open-source and free web server. Here, we will configure apache to set...

How to add user to sudo group in a Linux VPS?

With Sudo you can provide special privileges to any user or group. In Linux, there are few...