1833777 Members
2094 Online
110063 Solutions
New Discussion

spce utilization

 
SOLVED
Go to solution
navin
Super Advisor

spce utilization

Hello,
I have to find out directories that have 10MB or higher on a directory and down to that directory tree.How do i do that.please advice - i have tried sort.
Thanks in advance
Learning ...
7 REPLIES 7
Paul Sperry
Honored Contributor

Re: spce utilization

I'd use du
Paul Sperry
Honored Contributor

Re: spce utilization

man du
James R. Ferguson
Acclaimed Contributor
Solution

Re: spce utilization

Hi Navin:

# du -xk|sort -krn1,1|awk '$1>1024*1024*10'

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor

Re: spce utilization

Hi (again):

Oops! 'du -k' counts in 1024-byte blocks, so for 10 MB use:

du -xk|sort -krn1,1|awk '$1>10*1024'

Regards!

...JRF...
john123
Trusted Contributor

Re: spce utilization

Hi Navin..

To search only for directories that is larger than 10mb and to omitt the files present the in the first level directory

#find . -type d |du -xk|sort -krn1,1|awk '$1>1024*1024*10'
James R. Ferguson
Acclaimed Contributor

Re: spce utilization

Hi:

> John123: There is no need to use 'find' piped to 'du'. By default, 'du' reports *directory* elements unless you were to use its '-a' switch. You should at least copy my corrected post, to say "me too!".

Regards!

...JRF...
john123
Trusted Contributor

Re: spce utilization

You are right JRF...:)