[NTLUG:Discuss] quiest way to find out largest file in the disk (use command line) ?

kbrannen@gte.net kbrannen at gte.net
Sat Mar 6 19:19:01 CST 2004


Jack Snodgrass wrote:
> On Mon, 2004-03-01 at 07:58, m m wrote:
> 
> 
>>suddently, my disk went to 97% usage. (only 3% free space)
>>
>>Is there any way to list top 10 lagest files in the same disk?
>>
>>if not, how about in the same directory (includes sub-directories), say /usr 
>>or /var ?
>>
>>use console/command line only [no X-windows available :( ]
> 
> 
> 
> I generally start at / and work my way down from there. 
> cd to / and do 
> du -s -k -d * | sort -n
> this will give you all of your dirs under / sorted by size.
> cd to the largest dir and do 
> du -s -k -d * | sort -n
> again.  see if you can find the huge directory/file. 

Why not leave out the -s and just do:

du DIR | sort -nr | head -20

for the 20 biggest files/dirs?  Obviously, use / for DIR to look at your whole 
system.

HTH,
Kevin



More information about the Discuss mailing list