Skip to content

What is DF? How to check disk space in Linux using DF?

  • by
  • 3 min read

The Linux terminal is crammed with commands that you can use to control and inspect just about any aspect of your machine. Be it checking your network status, user accounts or your disk storage.

In this article, we’re taking a look at the DF command and how you can use it to check disk space in Linux.

Also readHow to shutdown Linux from Command Line?


Using the DF command

The basic syntax for the DF command goes like this.

df [flags] filesystem

If you execute the command without any flags (or options), it’ll just output all mounted file systems with relevant information. The data is printed in the following format.

What is DF? How to check disk space in Linux using DF?
  • Filesystem: The name of the file system. 
  • 1K-blocks: Describes the size of the filesystem in terms of 1K data blocks.
  • Used: This shows how many of those 1K blocks are used.
  • Available: This shows how many of those 1K blocks are available.
  • Use%: This shows the percentage of used space out of total space.
  • Mounted on: This shows the directory on which the filesystem is mounted or accessible. 

If you’re looking for a specific file system, mention the name or the mount point in front of the df command. For example, if you want to see the root directory, this is the command you’ll use. 

df /

Also read: Linux Chown command explained


Showing Disk Space in human-readable format

As you can see, the df command’s output isn’t exactly beneficial. The command prints out disk space in terms of 1K memory blocks which is super easy for computers to understand, not so much for humans. 

To display disk space in a human-readable format, use the -h flag with the command.

df -h

There are other flags that you can use to further filter information from the command. 

  • -t: Displays the fil;e system types along with the output.
  • -x [file system type]: Allows users to limit the out to file system excluding the mentioned type. 
  • -i: Displays the inode usage of each file system, 

Also read: Linux Sudo command explained

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: yadullahabidi@pm.me.

>
Exit mobile version