LOGO

Check Disk Usage on Ubuntu - Command Line

October 19, 2006
Check Disk Usage on Ubuntu - Command Line

Understanding Disk Usage with the 'du' Command in Ubuntu

Within the Ubuntu Linux operating system, as with other Unix-based systems, the du command-line utility is readily available. The abbreviation 'du' stands for Disk Usage, a logical designation for its function.

Basic Usage of the 'du' Command

To initiate a disk usage analysis, simply execute the command within your home directory. The initial output provides a detailed breakdown of disk space consumption.

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

Refining the Output for Practical Use

The default output from the du command can be quite extensive and, at times, less than immediately helpful. Fortunately, the utility offers a range of options to tailor the results to your specific needs.

To determine the total size of files and directories within the current directory, presented in megabytes, utilize the following command:

geek@ubuntu-desktop:~$ du -s -m *

1 Desktop

0 Examples

17 VMwareTools-5.5.2-29772.tar.gz

Interpreting the Results

This refined output provides a significantly more concise and practical overview of disk usage. The values displayed represent the size, in megabytes, occupied by each file or directory.

The -s flag ensures a summary output, while the -m flag specifies that sizes should be reported in megabytes. This combination delivers a clear and easily interpretable report.

#ubuntu#disk usage#command line#storage#space#df