Linux: Show Directory Size: du

By Xah Lee. Date: . Last updated: .

To show size of a directory, use du command.

How to find the size of a dir?

# show dir size of current dir
du --si -s .

How to find the size of all top-level subdirs?

# show size of current dir, human readable, 1st level dirs, sort by size.
du --si -d1 | sort -h
# show size of current dir, 1st level dirs, sort by size.
du -d1 | sort -n

Most important options:

Human readable forms. (kilo, mega, giga)

Specify your own units:

When using “sort”, use -n to sort by number, use -h to sort human readable form of number.

Directory Tree

See also: Linux: View Directory as Tree

Shell Basics

  1. Get System Info
  2. Shell Basics
  3. grep, cat, awk, uniq
  4. sort
  5. find, xargs
  6. diff Files/Dir
  7. dir size: du
  8. dir tree
  9. tar gzip bzip2 xz 7zip rar zip
  10. wget, curl, GET, HEAD
  11. rsync
  12. Install Packages

If you have a question, put $5 at patreon and message me.