Command to list large files

Looking for a line to show all of the large files on a unix server (over 300mb)...

Having problems finding anything that works...

TIA!

find /path -size +1048576 -exec ll {} \;

looks for about 500mb using blocks, 629145 ~ 300 MB

Thanks for the response... I went to my root and typed: find / -size +1048576 -exec 11 {} \;

And it didn't show any results... I was hoping I could find all of the files on the entire server for over 300MB and spit out the results. Thanks again!

that's ll (ell ell), not one one

Or ls -l

lol... just call me nub... :slight_smile:

Thanks again... but yea... I went to my root and ran this: find / -size +1048576 -exec ll {} \;

And it still shows no results... creepy

This may have come from ZazzyBob at some point, but I've been using it for a while.

In Linux this example shows the 10 largest in /opt. Change /opt to suit.

find /opt -type f -printf "%k %p\n" | sort -rn | head -10

Oh... I also tried ls -l, l and ls... still no go...

Tried that:

UX:find: ERROR: Illegal option -- -printf

Tried a few variations... no go... BTW... I'm running *cringe*... SCO

Ok.. I made *some* progress...

find / -size +1048576 -print

But.. it's not going through all of my directories and doesn't list the file size...

try

find / -size +1048576 -print | \
while read file
do
     ls -l "$file"
done

(I would have used xargs here but your system seems to be, um, different.)

FWIW - some utilities on older distributions don't follow POSIX, and some companies don't always follow guidelines either. The stuff I showed you was POSIX.2 compliant -
which doesn't guarantee it will work everywhere.
Next time you have a question be sure to include your OS information. It helps.

Thanks... works like a charm. I should have known to post my OS... :slight_smile:

Thanks again, and best of luck.

Oh... since I have ya... (grin)

Is there a way to exclude a directory? So.. if I want everything EXCEPT a directory (or multiple directories)...

Try:

or if you only want the 20 largest files:

naturally you can amend the 20 to be the largest x amount of files :wink:

Please note this only give you the file size and name and not owner info or date.

You could also try:

(this works on the current & child directories)

No need to go to root directory. As it is already mentioned / as path, it starts from root only.
find / -size <give the size here you want> 2>/dev/null | head

It will give the first 10 files having greater than specified size.