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

Related Articles

How to Install phpMyAdmin on CentOS 7?

phpMyAdmin is a web-based GUI tool to manage your MySQL and MariaDB Databases. It is an...

How to install Codeignetor centos 7?

Codeignetor is a PHP framework used to build a web application that is used widely by the...

How do I enable apache file and directory indexing in Linux or UNIX?

There are 2 ways to enable apache file and directory indexing. Using Apache config file : You...

How to change timezone from Joomla admin panel?

Changing timezone is very easy in Joomla. Please refer to the below steps to change timezone from...

How to Install and configure Dovecot on CentOS?

Dovecot is used to receive incoming emails on your server from Postfix. Dovecot is an open-source...

  • 0 Users Found This Useful

Was this answer helpful?