1831211 Members
2664 Online
110021 Solutions
New Discussion

Re: finding large files

 
SOLVED
Go to solution
Chris Baugh
Occasional Advisor

finding large files

does anyone know the best way of finding files where the size > 1Mb, ordering by size

I've used the following

ls -lR *|awk '{ if ( $5 > 1000000) print $0 } '|sort -n -k5,5

but this doesn't give the full path of the files

3 REPLIES 3
Robert-Jan Goossens
Honored Contributor
Solution

Re: finding large files

Hi,

db001:# cd /var
db001:/var# find . -size +1000 -exec ls -l {} \;

Robert-Jan.
Stefan Farrelly
Honored Contributor

Re: finding large files

find . -size +1000000c -print

Will list all files, and their path, which are over 1MB. To sort change to;

find . -size +1000000c -exec ls -l {} \; | sort -n -k5,5


Im from Palmerston North, New Zealand, but somehow ended up in London...
Darren Prior
Honored Contributor

Re: finding large files

du -ak | awk '{ if ( $1 > 1000) print $0 } '|sort -n

will give you the size and full path, however it includes dirs as well as files, so you'd need to add some extra scripting if you want to remove them.

regards,

Darren.
Calm down. It's only ones and zeros...