SEARCH

How-To Geek

Check your Disk Usage on Ubuntu from the command line

Ubuntu Linux, like all unix varieties, includes the du command line utility. du stands for Disk Usage, as I’m sure you assumed.

Go ahead, just type the command in your home directory:

geek@ubuntu-desktop:~$ du
8 ./.gconf/desktop/gnome/accessibility/keyboard
12 ./.gconf/desktop/gnome/accessibility
8 ./.gconf/desktop/gnome/screen/default/0
12 ./.gconf/desktop/gnome/screen/default
16 ./.gconf/desktop/gnome/screen
8 ./.gconf/desktop/gnome/font_rendering
40 ./.gconf/desktop/gnome
44 ./.gconf/desktop
8 ./.gconf/apps/panel/applets/clock_screen0/prefs
16 ./.gconf/apps/panel/applets/clock_screen0
8 ./.gconf/apps/panel/applets/trashapplet_screen0
8 ./.gconf/apps/panel/applets/workspace_switcher_screen0/prefs
16 ./.gconf/apps/panel/applets/workspace_switcher_screen0

It shows you a very verbose output by default, which isn’t always extremely useful. Thankfully it also includes a lot of extra options.

To find the total size of files and folders in our current directory, listed by MB:

geek@ubuntu-desktop:~$ du -s -m *
1 Desktop
0 Examples
17 VMwareTools-5.5.2-29772.tar.gz

Now we are getting somewhere. That’s some pretty useful output.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 10/19/06

Comments (7)

  1. nomad

    Add command df -h for checking partition usage

  2. paul

    try:
    df -h

  3. SqueakyNeb

    “du|grep something” will search the system from the current directory down for a file/directory called “something”.

  4. Amit

    try
    du -sh *
    it would give output in user readable format like 57K 3.6M 1.5G, hope it helps.

  5. Andrew P.

    Ubuntu Gnome Desktop users since release 7.04 (Feisty Fawn) now have access to a graphical Disk Usage Analyzer (baobab). It isn’t quite as intuitive as the “Properties” display that one gets when one right-clicks on a disk icon in Microsoft Windows, and it takes a while to run and gather information. The display is more detailed and potentially more useful. By default, the launch icon is usually installed under the Applications menu in the Accessories submenu. In the alternative, type “baobab” in a terminal window.

  6. Steve

    Thanks Amit

    I used to just use du -h(human readable) which was good but the -s(summarize) makes it even better

  7. oliwek

    geek@ubuntu-desktop:~$ du
    8 ./.gconf/desktop/gnome/accessibility/keyboard
    12 ./.gconf/desktop/gnome/accessibility

    What the numbers 8 and 12 stand for? bytes?

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!