Linux Command: df

Published on January 5, 2022 at 6:43 am by LEW

Introduction

The df command comes from Disk Free, and displays information on disk space usage on Linux/Unix systems. The basic command has been around since 1987.

Depending on command options, df provides the user with disk usage for currently mounted file systems.

Syntax and Function

The syntax for the df command is:

df [options][file]

While df has about eighteen options, there are only a couple of them used with any regularity by normal users.

If a file or directory argument is given, df returns the usage for the parent file system. For example the /etc directory is part of the root file system, so would return information for the root file system, and not the /etc directory.

Example

Basic usage of the command df is as follows, with no options.

df

This will print out all file system usage for the system, both physical and virtual (created in RAM as opposed to being on a drive). The sizes will be displayed as the number of in 1k blocks.

df -h /

This will print out the root file system, with the sizes displayed in powers of 1024. For example M for megabyte and G for Gigabyte. This is refereed to as human readable.

Options

There are a few options that most users will use with any regularity. They are as follows.

Conclusion

This is a quick overview of the df command to determine disk usage. For a complete list of options refer tot he man page for your specific distribution.

Add New Comment

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