Sort all directories based on their size

round assorted-color plastic cases

Freeing up storage space is a constant battle whether it is on your local computer or on your servers. To list directories and their file sizes, and then sorting them from the largest to smallest, makes life easier by using the following command:

du -sh -- */ | sort -rh

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.