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 Manage Linux VPS (SSD and Traditional) from VPS Management Portal?

We offer SolusVM VPS management portal with SSD Linux VPS and Ttraditional Linux VPS plans....

How to transfer cPanel accounts from Shared Hosting to VPS/Dedicated Server manually?

cPanel facilitates you to restore full cPanel account along with websites, email accounts, MySQL...

How to sync time using NTP in Ubuntu server?

Linux server users might have noticed that after adjusting the system clock to the correct time,...

How to Install Minecraft Game Server in Linux VPS?

This article will assist you to install Minecraft Server in your Linux VPS. Checkout our VPS...

Do you have any limits for setting up Cron jobs or schedule tasks?

Windows Shared Hosting Plans:We do not offer cron jobs in Windows shared hosting plans. Linux...