Summarize disk usage in unix

If you run out of space on a remote machine, or even your own Unix based PC, you can investigate where your disk usage problems are coming from with du and sort. This command will summarise disk usage info for the directories in your working directory:

du -sh * | sort -rgb

where for:

  • du
    -s prevents the program traversing subdirectories and providing information
    -h shows human readable size information (mb, gb ect.)
  • sort
    -r reverses the order (largest usage first)
    -g sorts numerically
    -b ignores whitespace

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s