The df command in Ubuntu Linux with examples

The provided content is a tutorial on using the ‘df’ command in Ubuntu Linux. The ‘df’ command presents disk usage information, providing users with insights on available and used space on mounted filesystems. The guide explains the basic syntax, various customizable options, and usage scenarios, enhancing the user’s understanding of their system’s storage situation.

This article explains using the df command in Ubuntu Linux. It also provides examples you can use in your environment.

The df command in Ubuntu Linux is a command-line tool that displays disk usage information. It gives users an overview of the available and used disk space on mounted filesystems.

You can customize the output using different options with the df command to suit your needs. Whether you want to check the overall disk usage or examine specific filesystems, the df command helps you understand your system’s storage utilization.

Syntax

The basic syntax of the df command is as follows:

df [OPTIONS] [FILESYSTEM]

Common options

Here are some of the commonly used options with the df command:

  • -h, --human-readable – Displays sizes in a more human-readable format, using units like K, M, G, etc.
  • -T, --print-type – Shows the filesystem type.
  • -i, --inodes – Displays the inode information instead of block usage.
  • -a, --all – Includes all filesystems, including those that are not mounted.
  • -x, --exclude-type=TYPE – Excludes filesystems of a specific type from the output.
  • -l, --local – Shows local filesystems only.

Usage examples

  1. Display disk space usage of all mounted filesystems in human-readable format:
df -h
  1. Show disk usage of a specific filesystem:
df /dev/sda1
  1. Exclude specific types of filesystems (e.g., tmpfs) from the output:
df -x tmpfs
  1. View disk usage inodes instead of block usage:
df -i
  1. Display all filesystems, including those that are not mounted:
df -a
  1. Show only local filesystems:
df -l

That should do it!

Remember to consult the man page for df (man df) to explore more advanced options and functionalities.

Conclusion:

After reading this article, you should now be able to:

  • Understand the purpose of the df command in Ubuntu Linux
  • Customize the output using different options with the df command
  • Check both the overall disk usage and specific file systems
  • Refer to the man page for df (man df) to explore more advanced options and functionalities.
Richard Avatar

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *


Exit mobile version