How to Find Out Top Directories and Files (Disk Space) in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Senthil Kumar

A Linux Consultant, living in India. He loves very much to write about Linux, Open Source, Computers and Internet. Apart from that, He'd like to review Internet tools and web services.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

11 Responses

  1. David Parker says:

    Only works with GNU find.

    # find /path/to/dir/ -printf '%s %p\n'| sort -nr | head -10
    # find . -printf '%s %p\n'| sort -nr | head -10
    Sample outputs:
    5700875 ./images/faq/2013/11/iftop-outputs.gif
    5459671 ./videos/faq/2013/12/glances/glances.webm
    5091119 ./videos/faq/2013/12/glances/glances.ogv
    4706278 ./images/faq/2013/09/
    3911341 ./videos/faq/2013/12/vim-exit/vim-exit.ogv
    3640181 ./videos/faq/2013/12/python-subprocess/python-subprocess.webm
    3571712 ./images/faq/2013/12/glances-demo-large.gif
    3222684 ./videos/faq/2013/12/vim-exit/vim-exit.mp4
    3198164 ./videos/faq/2013/12/python-subprocess/python-subprocess.ogv
    3056537 ./images/faq/2013/08/debian-as-parent-distribution.png.bak

    You can skip directories and only display files, type:

    find /path/to/search/ -type f -printf ‘%s %p\n’| sort -nr | head -10

  2. Staffing Services says:

    I tried this:

    # find . -type d -size +100M

    Which shows result like this:


    Now this is my issue. I only want the name of those files located in folders that are consuming space at / and not at /u01 or /home. Since / is base of everything, it is showing me every file of my server.

    Is is possible to get big files that is contributing to 78% of / ?

  3. Cloud Consulting Services says:

    “find / -type f -size +20000k -exec ls -lh {} ; | awk ‘{ print $8 “: ” $5 }’”

    needs to have the exec altered

    find / -type f -size +20000k -exec ls -lh {} \; | awk ‘{ print $8 “: ” $5 }’

    Also, I find this output easier to read

    find . -type f -size +20000k -exec ls -lh {} \; | awk ‘{print $5″: “$8}’

  4. This lists files recursively if they’re normal files, sorts by the 7th field (which is size in my find output; check yours), and shows just the first file.

    # find . -type f -ls | sort +7 | head -1

    The first option to find is the start path for the recursive search. A -type of f searches for normal files. Note that if you try to parse this as a filename, you may fail if the filename contains spaces, newlines or other special characters. The options to sort also vary by operating system. I’m using FreeBSD.

    A “better” but more complex and heavier solution would be to have find traverse the directories, but perhaps use stat to get the details about the file, then perhaps use awk to find the largest size. Note that the output of stat also depends on your operating system.

  5. Gilles Pion says:

    Sorting using “sort -n” the output of “du -Sh” (“h” stands for “human-readable”) gives incorrect results: sizes are printed by “du” in float values with trailing unit indicator (none, “K”, “G”). For instance 1.2M is sorted as *lower* than 4.0K (since 1 < 4) which is false.

    So, instead of
    find /home/tecmint/Downloads/ -type f -exec du -Sh {} + | sort -rh | head -n 5
    You'd better use
    find /home/tecmint/Downloads/ -type f -printf "%s %p\n" | sort -rn | head -n 5
    which gives the 5 top size files.

    • Gilles Pion says:

      Oups! Didn’t noticed the “-h” option to “sort” too (which I didn’t knew BTW).
      So that’s OK.

    • Ravi Saive says:


      Thanks for the tip, will include your command as alternative way to achieve the same results with better format..

  6. Good advice. I’ve put together a tool that makes a lot of this even easier, in case anyone is interested.

    I expect that urls are not permitted in content, but are invited for one’s name, so I’ve placed the bitbucket link to my script, “duke” there.

    • Ravi Saive says:


      Thanks for sharing the duke tool, seems excellent with nice presentation of files sizes and their ages, will surely write about this duke tool on our next article. Could you please send more about the tool and features at

  7. mikeg9b says:

    You can also use ncdu.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 202,035
  2. 9,267
  3. 38,621

Are you subscribed?