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

Jack Snodgrass jack at jacksnodgrass.com
Mon Mar 1 08:15:28 CST 2004


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. 

also ls -lS will show you files in a directory sorted by size. 

cd /
find . -printf "%s %h%f\n" | sort -nr | top -n50 
will ( probably ) look at all of the files on the system and show you
the top 50 in size. 
maybe... 

jack 


More information about the Discuss mailing list