How to Display Disk Space Usage in Ubuntu

  • Post category:Ubuntu

Managing your disk space is essential to maintaining a healthy and efficient system. In Ubuntu, you can quickly check your disk space usage with the df command. This guide will show you how to use df in a human-readable format to monitor your disk usage with ease.

Step-by-Step Guide: Using df -h to Display Disk Space

To check how much disk space is being used and how much is available on your Ubuntu system, follow these simple steps:

1. Open the Terminal

You can open the terminal by searching for “Terminal” in your applications menu or by pressing the shortcut Ctrl + Alt + T.

2. Run the df -h Command

In the terminal, type the following command and press Enter:

df -h

What Does This Command Do?

  • df: Stands for “disk filesystem.” This command reports the amount of disk space used and available on your system’s filesystems.
  • -h: This option means “human-readable.” It formats the output in more understandable units like kilobytes (K), megabytes (M), and gigabytes (G), instead of blocks.

Example Output of df -h

When you run the command, your output may look like this:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       457G   32G  403G   8% /
tmpfs           1.2G  2.1M  1.2G   1% /run
/dev/sdb1       100G   50G   51G  50% /data

This output shows details for each mounted filesystem, including the total size, used space, available space, percentage of use, and the mount point.

Additional df Command Options

Here are some useful options to enhance your disk space monitoring:

  • See All Filesystems: To display information about all mounted filesystems, simply use the basic df -h command:
  df -h
  • Check a Specific Filesystem: If you want to check disk usage for a specific filesystem or mount point, specify the path:
  df -h /path/to/mountpoint
  • Exclude Certain Filesystems: To exclude certain types of filesystems (like temporary filesystems), use:
  df -h --exclude-type=tmpfs

Conclusion

The df -h command is a quick and effective way to monitor disk space usage in Ubuntu. With its simple, human-readable format, you can easily assess how much space is being used across different filesystems on your system.

For more in-depth Ubuntu tutorials and Linux commands, check out other articles on codeallow.com.