Find largest files

Hello,
i am on linux 2.6.13-1.1526_FC4smp , and i would be very greatfull
if someone could help to find the largest files on that server.
I know i can find files with find command or list them with ls ,
but is there a way that i could list let's say 10 biggest files on server ?
:o

find / -exec ls -l {} \; | sort -nrk 5 | head

Another way which i am using currently..

find / -type f -exec ls -s {} \; | sort -n -r | head -5

try this also

find . -type f -xdev -ls | sort -nr +6 > /tmp/size.out

cd / ; du | sort -n -r | head -5

I'd limit the search to largish files or you will be sorting every filename on your system.

For example (the actual size depends what you have on your system):

find // -type f -size +1000000c   .....

It will give the size for directories only not files.

Thanks to all for their answers for this one.
It seems this could be very interesting thread. :wink:
Unfortunately, all ways metioned here to get the n largest files on the server , are not still how i imagined that this could be done.
Firstly , i am always getting the complete list of files that are searched on the screen, along with the messages like

find: //proc/3354/task/3354/fd: Permission denied

I am executing all those commands you suggested as oracle, not root.
And secondly , i still didn't recived result similiar to the following , something like
this, ONLY the first 5 biggest files(at least from the ones that i have permission to read) let's say in descending order; this should look like this i suppose :

/path/to/the/file/filename.ext 1000
/path/to/the/file/filename.ext   900
/path/to/the/file/filename.ext   800
/path/to/the/file/filename.ext   700
/path/to/the/file/filename.ext   600

Where those number would be bytes/megabytes of that file....

Is there something that could give this kind of result ? Without printing on the screen of the whole search/find/permissions issue process ?
...or even this output without those file size numbers...

sorry if I missunderstood/misstyped commads you provided , maybe they do exactly this ..
:o

It is not possible to find the largest files on the system unless you have root access. User "oracle" is no more special than any other normal user.

  1. Firstly, you should have permission to all the files if you'd want to find out biggest file in the whole file system.

So better try to run the find command with the super user privilege, else you would be getting those kind of errors.

  1. Secondly, if you don't want to see the errors then you can redirect it to /dev/null as,
find / -type f -exec ls -s {} \; 2>>/dev/null | sort -n -r | head -5

Also this find command would show the file names and sizes in descending order as you expected. ( but size first, and then the file name next. )

Hope this helped !

:b: thanks thegeek , you are really a geek. :wink: This is doing exactly what i wanted.
Could you please explain and point in the code you wrote how the redirect of the erorr is done,what is the purpose od dev/null and how is descending sort done ?

well, thanks a bunch !
And that link you provided with your write up is very interesting !
thanks!