How to sort directories (folders) by size in Linux

Sometimes you need to find out what are the biggest directories taking up space on your hard drive.

For example, you need to find out the email accounts that are using the most space up.

To sort the directories under the home partition in descending size order ...

du --si --max-depth=1 /home/ | sort -n -r |more

Breakdown:
du = show disk usage
-si = in human readable (aka "nice") numbers
--max-depth=1 only show this and 1 subdirectory deep

the output is then piped to sort in numeric order reversed (i.e. largest first)

the output is then piped to more so you get it page at a time.

  • 26 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

How do I stop Cpanel reporting /usr/bin/crontab permissions are wrong. Please set to 4755.

If you get this message in CPanel when adding/ediiting/viewing the cron jobs ......

How do I force Statistics (Webalizer and AWstats) to run on Plesk Servers ?

Updating Webalizer and AWStats on Linux Plesk Servers from SSH The plesk control panel is...

How much is HELM ? What Helm licences do you offer ?

Web Host Automation (HELM Authors) sold the control panel rights and code some years ago to...

How much is CPanel ? What CPanel licences do you offer ?

We work with a CPANEL authorised NOC partner, able to offer you discounted CPanel licences for...

How much is Plesk ? What Plesk licences do you offer ?

We are a PLESK authorised sales partner, able to offer you discounted Plesk licences for both...

Powered by WHMCompleteSolution