Linux Shell is a powerful tool for so many tasks, here is one single command to find the directories that has larger disk usage.

This command is helpful to track the disk usage and bring it down to the disk usage hogs.

Command

du -h <dir> 2>/dev/null | grep '[0-9\.]\+G'
Replace <dir> with your desired directory (for root use / )

Output

disk-space-usage

Explanation

du -h

Shows the directory and the sizes of each in a human readable format.

2>/dev/null

Discards output of non directories (such as /proc/)

grep '[0-9\.]\+G'

Sorts out directories that is 1+ GBs and up.

That’s it

Keep this command in your favorite command lists, it will be needed at really random times.

(Visited 467 times, 1 visits today)
Categories: Website

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published.