The fastest way to check disk space in Linux is to open your terminal and simply run the df -h command.

However, if you are managing a Linux VPS or dedicated server, keeping your storage healthy often requires a bit more digging.

When server storage runs out, it can trigger a cascade of critical problems:

  • Applications like your database or web server may crash because they can’t write new data
  • Essential system logs will stop recording
  • In a worst-case scenario, you could even be prevented from logging into your system entirely.

Fortunately, managing your storage doesn’t have to be complicated. Linux comes equipped with powerful built-in tools that give you a clear picture of your disk usage so you can take action before disaster strikes.

In this guide, you will learn several different methods to monitor and manage your drive, including how to check your overall disk usage, pinpoint exactly which directories are consuming your storage, track down the largest files, understand advanced metrics like inode usage, and take basic, actionable steps to free up disk space.

Linux Disk Space Commands at a Glance

Here are the most common commands to check disk space in Linux and what they do:

CommandWhat it showsExample usage
df -hFree and used space on all mounted filesystemsdf -h
df -iInode usage (number of files)df -i
du -sh <dir>Total size of a specific directorydu -sh /var/log
du -h –max-depth=1 <dir>Sizes of top-level subdirectoriesdu -h --max-depth=1 .
ncduInteractive, navigable disk usage viewersudo ncdu /
ls -lhSLargest files in a directory (sorted by size)ls -lhS /var/log
fdiskPartition tables and total physical disk capacitiessudo fdisk -l
lsblkTree view of all block devices (disks/partitions) and mount pointslsblk
dufModern, user-friendly, and colorized alternative to dfduf

How to Check Linux Disk Space with the df Command

The first and most common tool for checking disk space is the df command. This command is an abbreviation of disk free. It provides a high-level overview of the available and used space on all mounted filesystems. 

While you can simply type df, the output shows space in 1-kilobyte blocks, which isn’t very easy to read. For a much clearer view, we’ll use the -h (human-readable) flag. To use this tool, open your terminal and run the following command:

df -h

You will see an output similar to this:

Let’s break down what each column means:

  • Filesystem: This is the name of the system for the storage partition. You often see names like /dev/sda1 or /dev/vda1. These refer to the first partition on your primary hard drive. (sda is common for physical drives, while vda is often used for virtual server disks).
  • Size: The total size of the filesystem.
  • Used: The amount of space currently in use.
  • Avail: The amount of free space remaining.
  • Use%: The percentage of the disk that is full. This is the most important column to watch! If this number gets close to 100%, you may start having problems.
  • Mounted on: This is the directory in the file structure where the filesystem is accessible. The most important one is / (the “root” directory), as this is where your entire operating system and all its files are stored.

Suggested read: How to Check Linux CPU Usage or Utilization (5 Ways)

Useful df Options for Disk Space

The df command has several useful options that make it easier to narrow down problems, check filesystem types, and track inode usage.

How to Check a Specific Filesystem with df

You can specify the path if you only care about the space in a specific directory (like your home folder). For example:

df -h /home

How to Show Filesystem Type in Linux

You can use the -T flag to see the format of your filesystems (e.g., ext4, XFS). For example:

df -hT

How to Check Inode Usage in Linux

Sometimes, you can run out of “inodes” before you run out of disk space. An inode is a data structure that stores information about a file. Think of it like an entry in a library’s card catalog; every file needs one. If you have millions of tiny files, you might exhaust your inodes. To check this, use the -i flag. For Example:

df -i

Check Disk Space with duf 

While the standard df -h command gives you the information you need, it includes a lot of confusing “pseudo-filesystems” (like snap or tmpfs loops) and formats everything in plain text. duf automatically filters out the clutter, organizes your real hard drives into a beautiful, easy-to-read table, and uses colored output to immediately show you which drives are healthy and which are dangerously full.

How to Install duf: Depending on your Linux distribution, you can install it using your system’s package manager.

# For Ubuntu and Debian systems:
sudo apt update
sudo apt install duf
# For CentOS, RHEL, and Fedora systems:
sudo dnf install duf

How to Use duf: Once installed, simply type duf and hit Enter. You don’t even need to add any extra flags!

duf

Suggested read: How to Check OS Version in Linux via Command Line

How to Find What’s Using Disk Space in Linux

Once you know a disk is nearly full, the next step is finding what’s using the space. The du (disk usage) command helps by showing the size of files and directories so you can quickly spot what’s taking up the most room.

A simple du -h lists the size of every subdirectory, but that can be overwhelming. These options make du far more practical:

How to Use du to Check Disk Usage

The du command has several useful options depending on whether you need a quick summary or a detailed breakdown. Here are the most common ways to use it.

How to Get a Summary of Directory Size with du

The -s flag can be used to get a summary of disk usage. This command shows a single numerical value, which is the total size of the directory.

du -sh .

How to List Sizes of Top-Level Directories in Linux

This is perfect for quickly breaking down which folders are the largest without digging too deep. The –max-depth=1 flag tells du to only go one level down. For example, to check the folders in the current directory, you could run:

sudo du -h --max-depth=1

How to Find the Largest Directories in Linux

This is a favorite command of system administrators. It combines three tools to quickly pinpoint the biggest space hogs on your system. For example, if you want to check the ten biggest directories in the webapps directory, then you can run the following command:

du -h ./webapps/ | sort -rh | head -n 10

Let’s break down how this one-liner works:

  1. du -h <path>: Calculates the disk usage for every file and folder in the provided path.
  2. |: This is the “pipe.” It takes the output of the first command and sends it as the input to the next command.
  3. sort -rh: This sorts the list it receives from du. The -r flag reverses the sort to be descending (largest first), and the -h flag ensures it understands human-readable numbers (so “10G” is correctly sorted as larger than “2M”).
  4. | head -n 10: This final pipe takes the sorted list and shows only the top 10 lines.

How to Check Attached Disks with lsblk

The lsblk command provides a clean, tree-like overview of all block devices (such as hard drives and USB drives) attached to your system, along with their partitions. It is incredibly useful for quickly viewing your total disk capacities, device types, and structural mount points at a glance.

While it doesn’t show free space by default, it does show each disk’s storage capacity, and adding specific output parameters makes it highly informative for hardware storage audits.

# List all block devices with default columns
lsblk
# Display specific columns like name, total size, device type, and mount point
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT

Suggested read: ARM64 vs X64 – Everything you need to know

How to Monitor Disk Space and Set Up Automated Alerts

You can proactively monitor your storage to prevent sudden server crashes by alerting you before your disks fill up. You can write a simple Bash script that checks whether your disk usage exceeds a set threshold (e.g., 90%) and emails you an alert, which you can then automate to run daily via a cron job.

Open the text editor of your choice and paste the following code snippet to create a simple bash script:

# A simple bash script (monitor.sh) to alert if root usage is over 90%
THRESHOLD=90
CURRENT_USAGE=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
if [ "$CURRENT_USAGE" -gt "$THRESHOLD" ]; then
    echo "Warning: Disk usage is at ${CURRENT_USAGE}%" | mail -s "Disk Space Alert" [email protected]
fi

In the above example, remember to update your email address and then save it as monitor.sh. Once the file is saved, you can create a cron job to run the script every day at midnight and notify you.

Alternatively, if you want to skip the manual scripting entirely, consider using a modern server management panel like RunCloud, which provides built-in disk monitoring, beautiful dashboards, and automated notifications out of the box.

How to Check Disk Space Per User in Linux

If you are managing a multi-tenant VPS with several clients or team members, it is important to know exactly how much storage each individual account is consuming. You can quickly summarize the size of each user’s home directory using the du command with the summarize and human-readable parameters. 

Run the following command in your terminal to calculate and display the disk space used by each user’s home directory:

sudo du -sh /home/*

How to Check Disk Space with fdisk -l

The fdisk command is a popular disk manipulation tool that can be used for viewing your system’s partition tables and raw hardware capacities. It can display the total size of every attached storage drive, the sector sizes, and the exact partition boundaries. 

This command requires root privileges and is perfect for identifying unallocated disk space or confirming the actual physical capacity of your drives before formatting.

Run the following command to list partition tables and disk capacities for all attached devices:

sudo fdisk -l
# List the partition table and size for a specific disk only
sudo fdisk -l /dev/sda

Visual and Interactive Ways to Check Disk Space in Linux

Commands like df and du work everywhere, but sometimes a visual tool makes it faster to understand disk usage.

How to Use ncdu for Interactive Disk Usage in Linux

This is a fantastic command-line tool that scans a directory and then provides an interactive, navigable list. You can use your arrow keys to drill down into folders and quickly see what’s using the most space. To install ncdu on Debian and Ubuntu-based systems, run the command sudo apt install ncdu. For CentOS and RHEL systems, you can install it using sudo yum install ncdu. Once the installation is complete, you can scan the current directory by running the command sudo ncdu .

GUI Tools to Check Disk Space in Linux (Baobab, Filelight)

If you are using Linux with a graphical desktop environment, you have even more intuitive options.

  • Disk Usage Analyzer (Baobab): The default tool for GNOME-based desktops like Ubuntu. It provides a visual ring chart that makes it easy to see the largest directories.
  • Filelight: A similar tool for the KDE Plasma desktop environment. This tool displays the disk usage using visual charts, which makes it easy to gather information about your filesystem at a glance.

How to Free Up Disk Space in Linux

After you have analyzed that your disk is getting full. The next logical step is to perform a cleanup. However, before deleting anything, it’s important to be careful. Never delete files or directories you don’t recognize, as removing the wrong thing can damage your operating system.

Here are a few safe places to start cleaning to reclaim disk space.

Clean the Package Manager Cache

Package managers (like apt for Ubuntu/Debian or dnf/yum for Fedora/CentOS) download installation files and store them in a cache. After installation, these files are often no longer needed. This is usually the safest and easiest way to free up a good amount of space.

For Debian and Ubuntu-based systems:
These two commands will remove old installation files and any unused dependency packages:

sudo apt clean
sudo apt autoremove

For Fedora, CentOS, and RHEL-based systems:
This command will clear out all cached package data.

sudo dnf clean all

Or for older systems using yum:

sudo yum clean all 

Manage Large Log Files

By default, the system and application logs are stored in the /var/log directory. Over time, some of these files can grow to several gigabytes.

While you could delete a log file with rm, it’s not recommended. A running application may still be “holding” the file open, leading to issues. A safer method is to truncate the file, which empties its contents without deleting the file itself.

To empty a large log file, use the truncate command. For example, to empty a file named large-app.log:

sudo truncate -s 0 /var/log/large-app.log 

This command instantly sets the file’s size to zero, freeing up the space.

Review User and Temporary Files

  • /home Directory: This is where personal files, downloads, and documents are stored. Use the du commands covered earlier to navigate your home directory (/home/your-username) and find large files or directories that you no longer need.
  • /tmp Directory: This directory is used for temporary files. While most systems clear it on reboot, sometimes files can be left behind. It’s worth checking this directory for any old, large files that can be removed.

Clear Old System Logs

Your Linux system keeps detailed records of everything that happens behind the scenes. Over time, these “journal logs” can grow to take up gigabytes of space. You can safely delete logs older than a week without harming your system.

Execute the following command on your server to delete all systemd journal logs older than 7 days:

sudo journalctl --vacuum-time=7d

Clean Up Docker (If you use it)

If you run Docker containers on your server, you will quickly accumulate stopped containers, unused networks, and “dangling” images. Docker has a fantastic built-in command to wipe all of this unused data at once.

Run the following command to remove unused Docker containers, networks, images, and build cache:

sudo docker system prune -a

Key Takeaways on Checking Disk Space in Linux

Mastering command-line tools like df and du is a powerful skill that gives you direct control over your server’s health.

You are now equipped to diagnose one of the most common server issues, a full disk, and take precise action to free up space. Understanding these fundamentals is an important step in becoming a proficient Linux user and administrator.

Now that you understand the basics of checking and managing disk space, you can dive deeper into related commands and techniques. We recommend these guides for your next steps:

However, manually checking your disk space isn’t always practical, and by the time you realize there’s a problem, it might already be too late.

For those who want to move from reactive troubleshooting to proactive management, a modern server control panel is the answer.

This is where RunCloud shines.

RunCloud is designed to simplify every aspect of your server management workflow, including health monitoring. Instead of manually running commands, you get a clean, visual dashboard that displays your disk usage, CPU load, and memory at a glance. More importantly, you can configure alerts to be notified automatically when your disk space reaches a critical threshold, giving you plenty of time to act before it impacts your applications.

If you’re ready to spend less time managing and more time building, take the next step.

Sign up for RunCloud today and discover effortless server management.

Linux Disk Space FAQs

What is the difference between df and du in Linux?

Think of df as your car’s fuel gauge – it shows the total space used and free. du is like the trip computer – it shows which files and folders are using the space.
You use df to determine whether you have a problem and du to locate the problem.

Why does df show full disk, but du shows less usage?

This is a very common point of confusion. If df reports that a disk is 95% full but du only accounts for 85% of the space, there are usually two reasons for this:
Reserved Space: Most Linux filesystems (like ext4) reserve a percentage of the disk (typically 5%) exclusively for the root user. This safety measure prevents essential system services from crashing if a regular user fills up 100% of the disk. df includes this reserved space in its calculation of used space, while du only sums up the actual files it can see.
Deleted Files Held Open by a Process: In Linux, when you delete a file (e.g., a large log file), the space is not freed until the program that was using it closes the file. du will immediately stop seeing the deleted file and won’t count its size. However, df knows the space is still allocated on the disk until the process is restarted or ends. This is why it’s better to truncate active log files instead of deleting them.

What are inodes in Linux?

An inode is a data structure on the filesystem that stores all the information about a file except for its name and actual data. If you run out of inodes, you won’t be able to create new files or directories, even if you still have plenty of physical disk space left. This situation is most common on systems with millions of very small files, so checking inode usage with df -i is an important diagnostic step if you cannot save new files on a disk that appears to have free space.

Is it safe to delete files in /tmp?

Generally, it is safe to delete older files from the /tmp directory, as it is intended for temporary data that applications no longer need. However, you should avoid deleting files that are actively being used, so it’s best to remove files that haven’t been accessed in a while. The safest approach is to let the system handle it, as most Linux distributions are configured to clear the /tmp directory automatically during a reboot.