Home / Blog / df Command in Linux: Check Disk Space Usage

df Command in Linux: Check Disk Space Usage

The Linux df command helps developers and system administrators monitor available and used disk space. Learn how to use df, understand its output, and check filesystem storage from the command line.

df Command in Linux: Check Disk Space Usage

df Command in Linux

Disk space is an important resource on any Linux system. When a server starts running out of storage, applications may fail, logs may stop writing, and system performance can be affected.

The df command provides information about the amount of disk space used and available on mounted filesystems.

What Is the df Command?

df stands for disk filesystem. It displays information about filesystem disk-space usage.

The basic command is:

 
df
 

It typically shows the filesystem, total space, used space, available space, usage percentage, and mount point.

Use df -h for Readable Output

One of the most useful options is:

 
df -h
 

The -h option displays values in a human-readable format such as MB, GB, or TB.

Example:

 
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        50G   32G   16G  67% /
 

This makes it much easier to understand disk usage.

Check a Specific Filesystem

You can also check the filesystem containing a particular directory:

 
df -h /var
 

This is useful when troubleshooting a specific location on a server.

Check Inodes

Linux filesystems can also run out of inodes, even when disk space is still available.

Use:

 
df -i
 

This displays inode usage and can help identify problems caused by very large numbers of small files.

Why Is df Useful?

The command is commonly used for:

  • Monitoring server storage.
  • Troubleshooting full disks.
  • Checking available space.
  • Investigating application failures.
  • Monitoring filesystem capacity.

For regular server administration, df -h is usually one of the first commands to run when investigating disk-space problems.

df vs du

The df command shows filesystem-level disk usage.

The du command is generally used to determine how much space individual files and directories are consuming.

For example:

 
du -sh /var/log
 

Using df and du together can help identify both the overall storage situation and which directories are consuming space.

Best Practices

Check disk usage regularly on production servers, especially systems that generate large log files or process uploaded files.

When a filesystem approaches capacity, identify large or unnecessary files before deleting anything. Avoid removing system files simply to free space.

Conclusion

The Linux df command is a simple and essential tool for monitoring filesystem storage. With commands such as df -h and df -i, developers and system administrators can quickly check available disk space and inode usage.

Understanding df is particularly useful for maintaining healthy Linux servers and troubleshooting storage-related issues.

Contact Us

1119 W Duarte Rd, Arcadia, CA 91007

Solace Infotech Pvt. Ltd, Supreme HQ,
          HQ3C+9F2, Yash Orchid Society,
          Baner, Pune, Maharashtra 411021

4th Floor, Samraat Nucleus,
           Mumbai Naka, Nashik - 422001