How do you find the largest directory in Linux?

Probably you have asked question for performing housekeeping or identifying which directory is consuming much space. As a Linux Admin I use below commands for identifying which directory or file is consuming space or has large size:

  1. # du -chx --max-depth=1 /tmp 


  1. # du -chx --max-depth=1 --block-size=M /tmp | sort -nr | head -5 

Note: In above second command option I have used —block-size=M which mean it will highlight only directory or file which has size byte block in MB or Megabyte You can use any size byte block unit as per your requirement like you can use G or GB(Gigabyte).

Next Post Previous Post
No Comment
Add Comment
comment url