Find the Biggest Folders

The following command shows the top 10 biggest directories in the current tree.

du -hsx * | sort -hr | head -n 10

Explanation

du

du is a command that displays the size of files and folders.

The * will give a summary per file and folder in the current directory.

Flag Options

  • -h Human readable format
  • -s Display a total for each argument
  • -x Skip directories on different file system

sort

sort is a command that sorts alphabetically every line pass to it.

Flag Options

  • -h compare human readable numbers
  • -r reverse order (biggest to smallest)

head

head is a command that displays the n first lines pass to it.

Flag Options

  • -n the number of line to display.

Links

Advertisement