Operating System - HP-UX
1825730 Members
2553 Online
109687 Solutions
New Discussion

How to find the largest directory

 
Binu_5
Regular Advisor

How to find the largest directory

Hi

Can somebody tell me how to check the largest
directory in a file system

Thanks
Binu
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: How to find the largest directory

cd /filesystem

du -sk | sort -rn | more

or

du -k | sort -rn | more

I think its the first choice.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Muthukumar_5
Honored Contributor

Re: How to find the largest directory

You want to get the path length or in size?

You can get all directories in a directory with path length as,

find / -type d | awk '{ print $0" "length($0); }'

hth.
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: How to find the largest directory

To get directory with size then,

# cd
# du -k | sort -r

hth.
Easy to suggest when don't know about the problem!
Alessandro Pilati
Esteemed Contributor

Re: How to find the largest directory

FSS=your_FS_name
du -k $FSS |sort -r -n +0|grep -v "$FSS$"|head -1
It will give you the exactly biggest subdir name and size of your FSS

Regards,
Alex
if you don't try, you'll never know if you are able to
Cem Tugrul
Esteemed Contributor

Re: How to find the largest directory

Binu,

cd /file_system
du -ks * |sort -n

Good Luck,
Our greatest duty in this life is to help others. And please, if you can't