10 Useful du (Disk Usage) Commands to Find Disk Usage of Files and Directories

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

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. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  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.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

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...

30 Responses

  1. K. de Jong says:

    A kilobyte is 1000 bytes, always has (referring to the -k switch part). A kilo is always a unit of 1000 (e.g. a kilometer is also 1000 meters). A kibibyte is 1024 bytes. I know that Americans aren’t used to the metric system, but please, get it right when you do use it. I see these mistakes happen in blogs like these all the time…

  2. jilson says:

    How can i find the 1st five largest in the file /etc.

  3. Ayush says:

    If I want to calculate the size of files with particular extensions in a directory. How can I calculate it?

  4. Stranger says:

    Does any one know or experienced the output of “du -csh” mismatched with grand total ?

    For ex: du -csh *
    10M File_A
    14M Dir_A
    22M total

    but expectation is 24 MB as total.

  5. Cedric says:

    I would like to mention also this combination, in order to find the biggest sub-folders in current location:

    du -h –max-depth=1


    • no one in particular says:

      Yes – I ended up going to an ancient site looking for that switch – it should be like number 2 on the list.

      fyi: On some systems – freebsd is particular, depth is just -d [depth] – so “du -d 1 -h” is the secret sauce for the question ‘wtf happened to my space?’

  6. rlinux57 says:

    Is is possible to collect historical data analysis of disk space usage per user ?

    • Ravi Saive says:


      No you can’t use du (disk usage) command to get the disk space usage per user, yes but you can do use some command-line tricks with the help of find and awk command to find out the disk space usage for all users on the system including root user, here is the command.

      # find . -printf "%u  %s\n" | awk '{user[$1]+=$2}; END{ for( i in user) print i " " user[i]}'
      • rlinux57 says:

        But i need want to get the historical disk space usage, not current usage.

        • soft says:

          You could start a cron to run this command at different times to log the historical data
          find / -printf “%u %s\n” | awk ‘{user[$1]+=$2}; END{ for( i in user) print i ” ” user[i]}’

          • soft says:

            find / -printf “%u %s\n” | awk ‘{user[$1]+=$2}; END{ for( i in user) print i ” ” user[i]}’ > /yourlogdir/log_`date +_%m_%d_%Y_%H%M%S`

  7. rosh says:

    Another nice option is to sort by size: du -h * | sort -h

  8. Ashish Karpe says:

    how to find du of / ie when I ran du -sh / it gives du: cannot access `./proc/14498/task/14518/fdinfo/35147′: No such file or directory
    du: cannot access `./proc/14498/task/14518/fdinfo/35156′: No such file or directory

  9. Yasminhth says:

    Thanks for tips. Well explain ans example

  10. abhi says:

    very nice work. It helped me.

Got something to say? Join the discussion.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.