How To: Check Disk Usage With ‘df’

In today’s article, we’re going to do exactly what the title suggests; we’re going to check disk usage with ‘df’. This means we’ll be checking disk usage in the terminal. Seeing as ‘df’ is included with every distro on the planet (I’m pretty sure) it means this won’t be all that complicated.

I am still a bit under the weather, but the show must go on! I’ve gone this long without missing a publication date, so I might just as well keep the  streak up. 

As the title suggests, we’ll be using ‘df’ to check disk usage. This will already be installed as one of the default tools, so you won’t need to install it. That’ll save some time! If you’re curious, the ‘df’ tool describes itself as:

df – report file system disk space usage

If you want to get a head start, you can check the help page. To do that, you’ll want to run:

If you’re like to check the version, the command is:

So, with that in mind, let’s just jump into the article.

Check Disk Usage With ‘df’:

Obviously, this is yet another article where we’re learning about doing things in the terminal. That means you’ll need an open terminal. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal now open, you can just run the command by itself:

In some cases, it will throw an error and not be able to read everything. That’s usually easily resolved. Just run the command as a privileged user. So that would look like:

Now, you can use that output to do a bunch of math, or just pay attention to the percentages. Or, if you’re wanting, you can use the -h flag and get the output in human-readable format. That looks like:

The output of which might look a little something like this:

the output of sudo df -h
See? No errors and it is nice and readable! You can’t go wrong with that!

As you can see in the picture, I’m only using less than half of my available disk space. I don’t need to worry about running out of space any time soon, but if it gets low I can always check disk usage with ‘df’. Also, it doesn’t matter what directory you’re in when you run the command. As you can see, it runs just fine while in the Downloads directory.

I also wrote an article about using GUI methods to visualize disk space usage. You might prefer one of those methods, but you can always just use the terminal to check disk space.

Closure:

It seemed like a good idea to do a quick article tonight. I’m watching IMSA’s last race of the season and feeling poorly, so hopefully I get some sleep at a reasonable hour. Still, as I mentioned, the show must go on. The site has had a new article every other day for quite a while. I might as well keep up the schedule.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe to Newsletter!
Get notified when new articles are published!
We promise to never share your email!
icon

Author: KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Leave a Reply

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

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.