df command in Linux with examples

On Linux or Unix-based systems, the df command is used to display the free disc space of a specific file system. Simply type "df" to see a summary of the filesystem's information. In layman's terms, programme df aids in the retrieval of data from any hard disc or mounted device, including CD, DVD, and flash drives.

Syntax of the "df" Command

df Linux Commands with Examples

1. Display the Disk Space Usage.

To view disc space usage, run the df command without any arguments. It will display disc space consumption in tabular format.

The df command can be used to determine the amount of free space on a machine or file system. Run the following command:

Syntax:

df

We can observe the file system, the size of the file system in 1k blocks, the used space, the available space, the percentage applied by the file system, and the mount point from the output above.

2. Show the file system type

The file system type is displayed with the '-T' option. It will output a new column with the file system type.

Syntax:

df -T

We can observe from the above output, that the column 'type' has been added with output.

3. Show the disc space usage in a readable format

The '-h' option displays the disc space in human-readable format. It will display the size in powers of 1024, appending G for gigabytes, M for megabytes, and B for bytes.

Syntax:

df -h

4. Exclude file systems with modest sizes and provide a total at the conclusion.

This option generates a total for the size, usage, and available columns in the report.

Syntax:

df --total

The grand total is specified in the last row of the above table output.

5. Display inode information.

If inode information is required, the df option '-i' is available.

Syntax:

df -i

6. Display all available options --help.

For more help, you can use this '--help' option.

Syntax:

df --help

This blog contains some df commands as well as examples of how to use them. Even if you are familiar with this command, one of the cases listed may be unfamiliar to you.


Monitor Server Disk Utilization with Infrastructure Monitoring

It is very critical to monitor disk utilization for all your servers and get notified if it crosses 80-90% of the disk space.

With Atatus Infrastructure monitoring, you can keep track of the disk, memory and cpu usage of all the devices in your cloud. Atatus monitors your disk space automatically, preventing server outages and unexpected failures.

Infrastructure Monitoring
Infrastructure Monitoring

You can set thresholds to monitor free disk space, receive alerts when a threshold is breached, and ensure the ongoing availability of servers.

Try your 14-day free trial of Atatus.

Atatus

#1 Solution for Logs, Traces & Metrics

tick-logo APM

tick-logo Kubernetes

tick-logo Logs

tick-logo Synthetics

tick-logo RUM

tick-logo Serverless

tick-logo Security

tick-logo More

Sindhu

Sindhu

Sindhu is a Content Writer at Atatus. She's a lifelong learner with a curiosity to learn new things.
Chennai