Using the Linux df command

Jack Wallen
Feb 25, 2011
Updated • Jan 1, 2013

The Linux df command is an incredibly useful tool. What this command does is report file system disk usage. So when you want to see how much file system disk space is available, you can fire up your terminal and use df to learn everything you need to know about disk usage.

But you don't want to just know the very basics of the command. Like anyone who hopes to master the Linux operating system, you want to know the commands in all their glory. With that in mind, let's take an in-depth look at the df command and see what we can get out of it.

Basic usage

To understand the non-basic usage of the df command you must first understand the basic usage. So, the basic usage of df is:


Where [OPTION] is any one (or combination) of the available options and FILE is a file located on a specific disk or partition. Don't get confused about this. If you specify a file you will not see how much disk space the particular file uses. What you will see is the disk usage of the disk or partition the file resides on. This is a bit confusing at first.

The possible options are:

  • a - Include dummy file systems.
  • -B - Use SIZE in blocks.
  • --total - Produce a grand total.
  • -h - Print sizes in human readable formats.
  • -H - Print sizes in human readable formats, but use powers of 1000 and not 1024.
  • -i - List inode information and not block usage.
  • -l - Limit listing to local file systems.
  • --no-sync - Do not invoke sync before getting usage information.
  • -P - Use POSIX output format.
  • --sync - Invoke sync before getting usage information.
  • -t - Limit listing to file systems of TYPE.
  • -T - Print file system type.
  • -x - Exclude file system type.

Now, let's piece some of these options together to make df really useful.

Figure 1
Figure 2

Obviously, the basic usage is df. When you use that command you will see something like you see in Figure 1. If you're looking for a much easier to read output, you would issue the command df -h. That will display everything in human readable format (see Figure 2).

Now, let's add the partition types to the listing. To do this you would issue the command df -hT. This output would be similar to that in Figure 2, only it would add a column for Type before the Size column.

Figure 3

If you have a need to know the size of dummy file systems (such as dev, usb, proc, etc) on your machine, you could run the command like df -ah. This will add rows to your listing that will look like that shown in Figure 3.

Figure 4

What if you want to see a grand total of the percentage of disk space being used across all of your drives? To do this, issue the command df --total and you will see a new line added to the output that looks similar to what you see in Figure 4.

Final thoughts

A little df fun to help you gather all the knowledge you need with regards to how much space has been taken up on your disks. There are plenty of other tools to help you get this (and more) information from the command line. We'll deal with more of those later.





Previous Post: «
Next Post: «


  1. screw terminals said on March 2, 2011 at 4:06 am

    -i – List inode information and not block usage.

    that doesn’t always work for me

  2. Dotan Cohen said on February 28, 2011 at 10:44 am

    What is this Verbose Mode in the screenshots? Why isn’t this discussed in the article?

  3. Tony Charles said on February 25, 2011 at 5:35 pm


    I was wondering if you were currently accepting advertising on your site?
    We are looking for sites such as yours to palce contextual and relevant advertising on.
    We already work with a large number of happy publishers with very positive feedback.
    Please reply to this email and let me know that you are interested and I will get some
    more information across to you.

    Kind regards,

    Tony Charles

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.