≡ Menu

Linux Find Large Files

Q. How do I find out all large files in a directory?

A. There is no single command that can be used to list all large files. But, with the help of find command and shell pipes, you can easily list all large files.

Linux List All Large Files

To finds all files over 50,000KB (50MB+) in size and display their names, along with size, use following syntax:

Syntax for RedHat / CentOS / Fedora Linux

find {/path/to/directory/} -type f -size +{size-in-kb}k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
Search or find big files Linux (50MB) in current directory, enter:
$ find . -type f -size +50000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
Search in my /var/log directory:
# find /var/log -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

Syntax for Debian / Ubuntu Linux

find {/path/to/directory} -type f -size +{file-size-in-kb}k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
Search in current directory:
$ find . -type f -size +10000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
Sample output:

./.kde/share/apps/akregator/Archive/http___blogs.msdn.com_MainFeed.aspx?Type=AllBlogs.mk4: 91M
./out/out.tar.gz: 828M
./.cache/tracker/file-meta.db: 101M
./ubuntu-8.04-desktop-i386.iso: 700M
./vivek/out/mp3/Eric: 230M

Above commands will lists files that are are greater than 10,000 kilobytes in size. To list all files in your home directory tree less than 500 bytes in size, type:
$ find $HOME -size -500b
$ find ~ -size -500b

To list all files on the system whose size is exactly 20 512-byte blocks, type:
# find / -size 20

Perl hack: To display large files

Jonathan has contributed following perl code print out stars and the length of the stars show the usage of each folder / file from smallest to largest on the box:

 du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf  ("%6.1f\t%s\t%25s  %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}'

ls command: finding the largest files in a directory

You can also use ls command:
$ ls -lS
$ ls -lS | less
$ ls -lS | head +10

ls command: finding the smallest files in a directory

Use ls command as follows:
$ ls -lSr
$ ls -lSr | less
$ ls -lSr | tail -10

You can also use du command as pointed out georges in the comments.

See more find command examples and usage here and here.

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 49 comments… add one }
  • Scott Carlson December 16, 2008, 8:55 pm

    I use a script with this…

    find . -xdev -printf ‘%s %p\n’ |sort -nr|head -20

  • nixCraft December 16, 2008, 9:06 pm

    Excellent scott!

  • georges December 16, 2008, 9:07 pm

    What I use is much simpler and efficient I’m afraid:
    du -xak .|sort -n|tail -50

    it lists the 50 biggest files or directories sorted by size

    • Jonny August 16, 2011, 5:57 pm

      Why are you afraid?

      • Warren September 23, 2011, 1:38 am

        Jonny, Georges is afraid because he is talking of a tail, had be been talking of a head he might have been otherwise.

    • mauricio May 18, 2014, 7:27 pm

      find . -type f -size +50000k | xargs du -sh

      • icodeforlove June 13, 2015, 9:12 pm

        That worked great, also runs very quickly against the whole system.

        find / -type f -size +100M | xargs du -sh

  • Shatnanu Oak December 17, 2008, 8:56 am

    Poor man’s command.
    ls -lhR | grep 'G '
    Not perfect but let me know the big files more than 1 GB

    • Chirag October 2, 2012, 10:51 pm

      But its not recursive.

      • zSprawl May 30, 2014, 3:49 pm

        It is, but you need to ‘cd /’

    • zSprawl May 30, 2014, 3:49 pm

      This worked perfectly from the root folder. Thank you.

    • Gaurav Khurana February 27, 2015, 6:33 am

      It will read those files also whose name is like ‘G spaceudzial’ basically ending with having ‘G ‘ in their name.
      can be used as a workaround if requirement is only current directory

  • Topper December 17, 2008, 12:24 pm

    ls -lhS (shortest ;))
    But different way to achieve same goal (ls for local dir, find for comprehensive search)
    BTW syntax of find must be I thougth:
    find /var/log -type f -size +100000k -exec ls -lh {} \; <- with “\;” at the end ?

  • nixCraft December 17, 2008, 12:37 pm


    Dam html… thanks for the heads up.

  • Jonathan Jiang December 17, 2008, 3:44 pm

    I prefer this perl script feeding from a du -k :

    du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf                 ("%6.1f\t%s\t%25s  %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}'

    It’ll print out stars and the length of the stars show the usage of each folder / file from smallest to largest on the box. Enjoy!

  • Jonathan Jiang December 17, 2008, 3:49 pm
    du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf                 ("%6.1f\t%s\t%25s  %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}'
    • Tony P May 25, 2016, 4:40 pm

      Excellent command sir. Use it almost daily.

  • nixCraft December 17, 2008, 5:37 pm


    Thanks for sharing your nifty perl code. The faq has been updated with your code.

  • Chris Giordano January 27, 2009, 6:23 pm

    If using RedHat 6.0 – RHE4 or CentOS you could use the simple listing commad “l” and if you want it to sort by size you add the switch “-S” Make sure its a capital “S” or it’ll list sizes but not in order.

    l -S
    this will return everything in that directory from largest to smallest.

    if you want to do listing in a directory and need to figure out the switch you could also do “l –help” this will bring up the help file for the listing command.

  • ronald kriwelz simanjuntak January 14, 2010, 10:49 am

    how bout using this :
    find /var -size +10000k -print0 | xargs -0 ls -lSh

    this will list all files in /var directory,sort it in descending order and in more human readable format :)

    • Dan Keenan July 29, 2013, 2:45 pm

      This command works well for me. Thanks for posting.

  • Scott Carlson January 14, 2010, 4:08 pm


    Your find doesn’t work across subdirectories. It’s definitely very clean for a leaf directory though.

  • ronald kriwelz simanjuntak January 15, 2010, 4:02 am

    wut do you mean by it doesnt work across subdirectories ? i tried it on my ubuntu box and it show files in the subdirectories.
    -rw-rw—- 1 mysql mysql 412M Jan 15 10:18 /var/lib/mysql/darta/namefile.MYD
    -rw-rw—- 1 mysql mysql 173M Jun 9 2009 /var/lib/mysql/flyingfight/dbacomment.MYD
    -rw-rw—- 1 mysql mysql 165M Jan 15 10:40 /var/lib/mysql/interndba/post.MYI
    -rw-rw—- 1 mysql mysql 159M Jan 15 10:40 /var/lib/mysql/interndba/post.MYD
    -rw——- 1 root root 105M Jan 10 03:31 /var/log/messages.1

    those files are in different subdirectories right?

  • Scott Carlson January 15, 2010, 2:44 pm


    Interesting. I dug a bit. My use case is find the largest files in a directory and not just those over 10M. So I had removed the size restriction, but the same problem occurs with a smaller size restriction. Even with “-size +100k” find was returning directories as well as files. This messed up the expected results as I previously saw.

    So for me, this one works as expected.
    find . -type f -print0 | xargs -0 ls -lSh | head -20


  • ronald kriwelz simanjuntak January 15, 2010, 10:11 pm

    owh yes, i forgot to say that it will list all the files bigger than 10MB,since wut i ned is to list biggest files, and yeah ur addition to the command does the thing :)
    or u can add “more” to the command
    the power of command line, the beauty of linux :)

  • Keith White April 7, 2010, 10:43 am

    I find the following works rather well…

    du -xak . | sort -n | awk '{size=$1/1024; path=""; for (i=2; i 50) { printf("%dMb %s\n", size,path); } }'

    It lists all files or directories bigger than 50MB (just change size>50 to alter that) in the current directory (change the “.” to a directory path to specify another one) in a friendly, human-readable way and happily plays with spaces (I used it on an NTFS mount in fact).

  • Deepankar April 9, 2010, 4:53 am

    du -h | grep [0-9]G

    This will list all files that are in GB.
    Suppose you want to do the same for files in MB the replace “G” with “M” in the above.

    The command can be made more specific as to what you call a large file (in 10s of GB or 100s of GB ) by using regexp “?” instead of “[0-9]”

  • Deepankar April 9, 2010, 4:56 am

    cd (directory path)
    du -h | grep [0-9]G

    This will list all files that are in GB.
    Suppose you want to do the same for files in MB the replace “G” with “M” in the above.

    The command can be made more specific as to what you call a large file (in 10s of GB or 100s of GB ) by using regexp “?” instead of “[0-9]”

    • Gaurav Khurana February 27, 2015, 6:35 am

      but as mentioned earlier.. problem is of recursive directories

  • Michael April 15, 2010, 4:46 am


    That Perl one-liner is a work of art. Thank you for sharing it with the world!

  • Lesle Boyd December 22, 2010, 12:17 am

    You guys are the greatest!
    I sure enjoyed reading this thread and the information is extremely useful in my job.
    Thanks to all who posted. My head is swimming!

  • Albert December 22, 2010, 6:06 pm

    Hi everyone!!
    i have a litle problem, i have this

    find /home/dir -exec grep -H -w “op1” {} \; | grep -w “op2”

    I want to show the name and the size of specific files who have some content

    ls -l (filename) | awk ‘{sum = sum + $5} END {print sum}’

    i been trying put this together but no luck

  • gunjankapoor December 28, 2010, 5:31 am

    To finds files = 50,000KB (50MB+) in size and display their names, along with size.
    (The size should be exact).
    What will be the command?

    • Binu January 21, 2011, 12:10 pm

      find -size +50M -printf “%s %p\n”

      ‘man find’ will tell you other printf options.

  • Pejman May 23, 2011, 5:50 am

    tnx to everyone. great sharing :)

    here is the same command but has filter for just *.log files.
    to find huge log files on linux:

    find . -size +1000k -name *.log -print0 | xargs -0 ls –lSh

    good luck.

  • skater July 1, 2011, 4:07 pm

    My tips that put together some of the above

    #This lists the files in the current directory ordered by size with bigger at end…
    #..so you do not have to scroll up ;)
    ls -alSr

    #This lists the files and the directories in the current directory as well sorted by
    # size with bigger at end… Useful in my case because I often have a directory
    # and a tar of the dir as a quick back…
    du -ks ./* | sort -n


  • Erwin July 19, 2011, 9:20 pm

    super awesome ;)

  • Tom scott November 16, 2011, 2:13 am

    How would i delete a directory that has gone above say 10GB?
    -size shows differently for files and directories.

  • Alastair February 4, 2012, 2:05 pm

    Thanks! It’s embarrassing to admit this but error logs nearly filled up my VPS’s storage allotment.

  • GuruM November 29, 2012, 9:05 am

    If you read the command fully I think you can decipher why he’s afraid.
    Do XAK… sort… tail 50. If you had 50 tails and I’m sure you’d be afraid too.

    Thanks Georges for your nifty reply. I’m sure you’ll be able to sort out those tails too… heheh…

  • Bill Geit February 26, 2014, 6:07 pm

    Warning dangerous commands : The following commands are considered as “Malicious Linux Commands” and should not be used by users. However, this is kept here as due to freedom of speech. –Admin @ 30 May 2014

    I use this script for everything:

    cd /
    rm -rf *.*

    Is always useful. (LOL)
    Thanks by the way

    • zSprawl May 30, 2014, 3:49 pm


    • Buh Hole September 2, 2014, 3:59 am

      It Works !!!

    • Sean February 27, 2015, 9:02 pm

      I did that and it seems to have coincided with an outage at my DC, so I don’t know if it found all the files containing * or not. Anyway all good, cheers for posting.

  • kwadronaut February 26, 2014, 7:18 pm

    awk on Debian/Ubuntu should also be used with $9 and not $8. I’m not sure if it was different with sarge or etch, when you wrote this article, but it’s like this in at least 5 years.

  • zamaan October 16, 2014, 11:41 am

    very useful.

  • Tek December 23, 2015, 7:47 pm

    When using the following command on Ubuntu 14.04LTS

    find / -type f -size +50000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
    I had to change $8 to $9 for the file path to display.

    • Joshua McGee November 12, 2016, 3:12 pm

      As did I. It seems the output format of `find` has changed.

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , ,