Linux Basics: How To Find Size of Directory Commands

Linux Basics: How To Find Size of Directory Commands

This is the first in a series of posts in coming where I’ll be writing about some basic commands that that will be of good use to new users.

Note: This is targeted at people little or no command line experience..

How can I as a new user to Linux display directory properties from the terminal?


The only requirement is the du command line tool. du comes with almost every Linux distro by default.

Check if du it’s on your system by running the command below in the terminal:

man du

du command estimates file space usage

Using du

Running du with no flag displays names of all directories including sub-directories and sizes in bytes.



Using the -h flag displays the sizes in human readable format, that is K, M and G representing Kilobyte, Megabyte and Gigabyte respectively.

du - h


To view a specific directory indicate that after du and flag as shown below:

du -h Mapmaker


Use -c to see grand total displayed:

du -ch


Use -s flag to display only grand total / disk space used for specific directories:

du -sh Mapmaker Sandbox


See man du for more flags and there uses

man du

man du

Knows other combinations of du? Share with myself and others here too.

10 Comments on this Post

  1. CoolHand

    It should be noted that these options are only valid for GNU du command. On AIX, for instance, none of this works as described above.

  2. BasketCase

    For the next step, check out ncdu:

  3. Sama Vim

    Just seconding BasketCase’s comment, ncdu is really good du supplement.

  4. Thanks for your suggestion, will check it out.

  5. I use du with sort to find directories using the most space. Warning: this may take some time for directories with a lot of files. You need to use -k here, not -h, so that the resulting numbers can be compared to each other in the sort:
    du -ks * | sort -n

  6. BasketCase

    Even better: du –one-file-system –human-readable –max-depth=1 | sort –human-numeric-sort

  1. […] article here: Linux Basics: How To Find Size of Directory Commands […]

  2. […]   Continue reading… […]

  3. […] Ncdu (NCurses Disk Usage) 是一个基于Ncurses库的du命令的界面。它通过大家熟知的du命令,为用户提供一个快速且容易被使用的界面。它可以显示磁盘使用的百分比,且允许你使用ncurses库的方式在目录之间导航。 […]

Leave a Comment