How to Determine Your Free Disk Space in Linux

This guide will show you how to determine your free disk space Linux using a series of commands that come with all Linux distributions.

Although hard drive space is cheap today and we happily throw a couple of terabytes into a server or a desktop, it’s amazing how often the disk gets full. Here are a few Linux tools to help you see how much of your disk has been eaten up, and what’s eating it up, so that you can do something about it before it gets out of hand.

If you prefer graphical utilities to command line stuff, you may want to check out the Disk Usage Analyzer app for Ubuntu. Otherwise, keep reading.

The first command we’ll look at is the “df” command. It comes bundled with all distributions of Linux. “df” stands for “disk free”. It gives you a reading of the state of all your partitions. It gives you the total disk space, the used space, the space available, and then the percentage of space being used.

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 57G 2.4G 52G 5% /
/dev/sda1 99M 12M 83M 12% /boot
/dev/sda2 15G 1.3G 13G 10% /home

The is the kind of reading you can get from df. In the above example I have used the option “-h” which gives the output in a human-readable format. So, instead of showing me the disk space in bytes it uses megabytes and gigabytes which is easier for us to interpret.

Another command I find a lot of use for is “du”. “du” stands for “disk usage”. It can give you a reading of the amount of space a file or folder is using up. To check the amount of space being consumed by a directory called ‘data’ use the following command:

# du -sh data
104K data/

For the above command I have used the following options – “-s” which stands for “summarize”, and “h”, which makes the output human-readable. You can also use this command to see the details of the files and directories inside a directory. To see the individual and total disk of usage or files and directories inside the “data” directory do the following:

# du -shc data/*
4.0K data/
64K data/logs_files
4.0K data/
8.0K data/
4.0K data/
4.0K data/
4.0K data/
4.0K data/data_backup.log
4.0K data/log_backup.log
100K total

We have added the option “c” to the previously used command. “c” adds total disk usage at the end.

Another tool that I use to checkout what’s on my disk is the “find” command. Using find I like to make a list of all the files over a certain size. Say I wanted to check to see which files in my ‘/home’ partition are larger than 10 MB, here’s what I would use:

# find /home -size +10000k

The command is pretty self-explanatory. You can change the “/home” to the directory you want to scan for files, and the “+10000k” to the size of file you want to filter it by.

Now you know how to determine your free disk space and it’s usage in Linux!

If this article helped you, I'd be grateful if you could share it on your preferred social network - it helps me a lot. If you're feeling particularly generous, you could buy me a coffee and I'd be super grateful :)

buy a coffee for

Home » Linux » How to Determine Your Free Disk Space in Linux

Leave a Comment

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