Jump to content

Howto: Find the largest directory/file in a directory

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
Guest_ptt3_*

Guest_ptt3_*
  • Guests
I needed to do this earlier and just learned so I thought I would share:

# du -ha /var | sort -n -r | head -n 10

-a : Include all files, not just directories (du command)
-h : Human readable format, display data in 1K, 2G (du command)
-n : Numeric sort (sort command)
-r : Reverse the result of comparisons (sort command)
-n 10 : Display 10 largest file. If you want 20 largest file replace 10 with 20. (head command)

#2
Guest_Jame_*

Guest_Jame_*
  • Guests
This little command always comes in handy when I need to know where my space is gone. Glad to see others are using it as well.

#3
Hektor

Hektor

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
This will come in handy, thanks for the post!

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Thanks for the post!

#5
Guest_ptt3_*

Guest_ptt3_*
  • Guests
No problem, if I find anything else I'll let you know.