Show the size of a directory

du -sh some/directory
Displays only the subtotal size of a directory with the -s option, and in human readable format.
Sample Output
blaine@blaine-workstation:~$ du -sh .
11G     .

By: Jacolyte
2010-02-21 02:08:28

These Might Interest You

  • Shows the size of the directory the command is ran in. The size is in MB and GB. There is no need to type the path, its the current working directory. Show Sample Output

    du -sh `pwd`
    djkee · 2011-10-30 08:47:23 0
  • Show sizes of all files and directories in a directory in size order. du -hs * | sort -hr for reverse order. Taken from Show Sample Output

    du -hs * | sort -h
    siliconmeadow · 2013-02-12 15:29:26 0
  • Prints the size of Directory in human readable format like KB MB or GB. If you want to see size each files and directories inside the directory use -a option as shown in second output and if you want a total sum then add -c option :) Show Sample Output

    du -h <Directory>
    Vasudev · 2010-06-04 03:14:37 0
  • it does provide much more information , the owner , group , the size in byte , and the last modified time a file or directory was ls -al : list all in long format Show Sample Output

    ls -al
    eastwind · 2009-11-12 12:27:32 0

What Others Think

you gotta be kidding... seriously, WTF...
sklm · 434 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: