October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk15 min

Linux / Unix – Checking Free Disk Space

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Free disk space is one of the first things to check when a Linux or Unix system starts behaving unexpectedly. Full filesystems can prevent logs from being written, packages from installing, databases from updating, and users from saving files.

The standard command-line tools for this job are df and du. df shows available space on mounted filesystems, while du helps locate which directories and files are consuming that space.

As an Amazon Associate I earn from qualifying purchases.

Disk capacity is not the only limit to watch. Filesystems can also run out of inodes, which means no new files can be created even if space appears to remain. Checking both block usage and inode usage gives a clearer view of storage health.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Using df to Check Filesystem Free Space

The primary command for checking free space on Linux and Unix filesystems is df, short for disk free. It reports space usage for mounted filesystems, showing how much storage is available, how much is used, and where each filesystem is mounted. This makes it the first command to run when a server reports “no space left on device,” an application cannot write files, or you simply need to confirm capacity before copying data.

#1 Best Overall
Learn How to Use Linux, Linux Mint Cinnamon 22 Bootable 8GB USB Flash Drive - Includes Boot Repair and Install Guide Now with USB Type C
  • Linux Mint 22 on a Bootable 8 GB USB type C OTG phone compatible storage
  • The preinstalled USB stick allows you to learn how to learn to use Linux, boot and load Linux without uninstalling your current OS
  • Comes with an easy-to-follow install guide. 24/7 software support via email included.
  • Comprehensive installation includes lifetime free updates and multi-language support, productivity suite, Web browser, instant messaging, image editing, multimedia, and email for your everyday needs
  • Boot repair is a very useful tool! This USB drive will work on all modern-day computers, laptops or desktops, custom builds or manufacture built!

Run df with no options to display all mounted filesystems using the default block size:

df

A typical output includes columns similar to these:

Column Meaning
Filesystem The device, volume, or virtual filesystem being reported, such as /dev/sda1 or tmpfs.
1K-blocks Total filesystem size in 1 KB blocks, unless a different block size is configured.
Used Amount of space currently consumed.
Available Space available for new files.
Use% Percentage of the filesystem currently used.
Mounted on The directory where the filesystem is attached, such as /, /home, or /var.

For day-to-day administration, the most useful form is usually df -h, which prints sizes in human-readable units such as KB, MB, GB, and TB:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

df -h

Example output might look like this:

Filesystem Size Used Avail Use% Mounted on
/dev/sda2 50G 31G 17G 65% /
/dev/sdb1 200G 155G 36G 82% /var
tmpfs 2.0G 0 2.0G 0% /dev/shm

In this example, the root filesystem mounted on / has 17 GB available, while /var is more heavily used at 82%. On many servers, /var deserves close attention because logs, package caches, mail queues, databases, and application data often grow there. A high percentage on / can be more serious, because the operating system itself may need that space for temporary files, updates, sockets, and service runtime data.

You can also ask df to show filesystem types with -T, which is helpful when a machine has a mix of local disks, network mounts, and temporary filesystems:

df -hT

This adds a Type column, such as ext4, xfs, nfs, zfs, or tmpfs. Filesystem type matters because behavior can vary. For example, tmpfs uses memory-backed storage, NFS reports space from a remote server, and ZFS may involve pools, datasets, quotas, or reservations that affect what applications can actually use.

To focus on local disk filesystems and reduce noise from pseudo-filesystems, you can use filtering options supported by many Linux versions of df:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

df -h -x tmpfs -x devtmpfs

To show only a specific filesystem type, use -t:

df -h -t ext4
df -h -t xfs

When reading df output, pay attention to the mount point rather than only the device name. A full /home filesystem affects user files, while a full /var filesystem may break logging or databases. The Available column is usually more actionable than raw size, because it shows how much space can still be allocated for new data on that mounted filesystem.

Displaying Disk Space in Human-Readable Format

The basic df output reports disk sizes in 1K blocks on many Linux and Unix systems, which is accurate but not always easy to scan quickly. For day-to-day administration, the most common improvement is to add the -h option, which displays values using readable units such as K, M, G, and T. This makes it much easier to see whether a filesystem has megabytes, gigabytes, or terabytes available without manually converting block counts.

Run the following command to show mounted filesystems with human-readable sizes:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

df -h

Typical output looks like this:

Filesystem Size Used Avail Use% Mounted on
/dev/sda2 50G 31G 17G 65% /
/dev/sdb1 200G 148G 43G 78% /var
tmpfs 2.0G 4.0M 2.0G 1% /run
/dev/sdc1 1.8T 1.2T 540G 70% /data

In this view, Size is the total filesystem size, Used is the amount currently consumed, Avail is the space available to regular users, and Use% shows the percentage used. The Mounted on column tells you where the filesystem is attached in the directory tree. For example, the line for /data shows a 1.8 TB filesystem with 540 GB available, while / has 17 GB free.

On many systems, df -h uses powers-of-1024 units, so one gibibyte is displayed as approximately 1.0G. If you prefer powers-of-1000 units, use -H instead:

df -H

The difference is small for small disks but becomes more visible on large volumes. The -h option is more common in Linux administration, while -H may be useful when comparing operating system output with storage vendor capacity labels, which often use decimal units.

Combining readable output with filesystem type

Human-readable output is often more useful when paired with filesystem type information. Add -T on Linux to include a Type column:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

df -hT

This can help distinguish local filesystems such as ext4, xfs, or btrfs from network and virtual filesystems such as nfs, tmpfs, or overlay. For example:

Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext4 50G 31G 17G 65% /
/dev/sdb1 xfs 200G 148G 43G 78% /var
server:/share nfs 500G 410G 90G 83% /mnt/share

Some Unix variants do not support every GNU df option. On macOS and BSD systems, df -h is available, but df -T may not behave the same way or may be absent. If a flag fails, check the local manual page with man df.

  • Use df -h for the standard readable view of free and used space.
  • Use df -H when decimal units are preferred.
  • Use df -hT on Linux when filesystem type is relevant.
  • Watch Use% and Avail together, since reserved blocks can make available space lower than a simple subtraction of used from total.

Checking Space for a Specific Mount Point or Directory

When a system has several filesystems, the overall disk report is often less useful than checking the exact location you care about. A server might have separate mounts for /, /home, /var, /tmp, application data, backups, or network storage. To check free space for one mount point or for the filesystem that contains a directory, pass the path to df.

For example, to check the root filesystem only, run df -h /. To check a separate home partition, run df -h /home. If logs are filling the system, df -h /var shows the free space on the filesystem where /var resides. The path does not have to be the mount point itself; df -h /var/log/nginx reports the filesystem that contains that directory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common examples

  • df -h / checks available space on the root filesystem.
  • df -h /home checks the filesystem used by user home directories.
  • df -h /var checks the filesystem commonly used for logs, caches, mail spools, and package data.
  • df -h /mnt/backup checks a mounted backup disk or network share.
  • df -h . checks the filesystem containing the current working directory.

A typical command such as df -h /var may return output similar to this:

Filesystem Size Used Avail Use% Mounted on
/dev/sda2 40G 31G 7.1G 82% /var

In this example, /var is on /dev/sda2, with 7.1G available and 82% used. If the Mounted on column shows / instead of /var, then /var is just a directory on the root filesystem rather than a separate mount. This distinction matters when troubleshooting: deleting files from /home will not free space on /var if they are separate filesystems.

For scripts, monitoring checks, or clean output, df can be combined with options that limit noise. Use df -h --output=source,size,used,avail,pcent,target /var on GNU/Linux systems to print only selected columns. On many Unix variants where --output is unavailable, use df -h /var and parse the standard columns with care. If a path is a symbolic link, df reports the filesystem for the resolved location, so checking both the link and its target can help when application directories are redirected to another disk.

Using du to Find Directory and File Usage

While df shows free and used space at the filesystem level, du shows how much space is being consumed by files and directories. This makes it the usual tool for answering questions such as “which directory is using all the space?” or “how large is this project, backup, or log directory?” The command name stands for disk usage, and by default it reports usage in filesystem blocks, which is accurate but not always convenient to read.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To check the total space used by a directory, use du with the -s option for a and -h for human-readable units:

du -sh /var/log

This prints a single total, such as 1.8G /var/log. Without -s, du walks through the directory tree and prints usage for each subdirectory, which is useful when you need more detail:

du -h /var/log

For a quick overview of the largest immediate subdirectories under a path, combine du with a depth limit. GNU/Linux systems commonly support --max-depth:

du -h --max-depth=1 /var

This lists the usage of directories directly under /var, such as /var/log, /var/cache, and /var/lib, without expanding every nested directory. On macOS and some BSD Unix systems, use -d instead:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

du -h -d 1 /var

Sorting Directory Usage

When a directory contains many entries, sorting the output helps identify the biggest consumers. On Linux, this is a common pattern:

du -h --max-depth=1 /home | sort -h

To show the largest entries at the bottom, sort -h sorts by human-readable sizes such as K, M, and G. To place the largest entries first, add -r:

du -h --max-depth=1 /home | sort -hr

If sort -h is not available on a Unix variant, use kilobyte output instead and sort numerically:

du -sk /home/* | sort -nr | head

Checking Files as Well as Directories

By default, du is most often used against directories, but it can also report file usage. For example, to check the disk usage of files in the current directory:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

du -h *

To get a combined total for several paths, use -c on systems that support it:

du -ch /var/log /var/cache

The final line shows a grand total. This is useful when estimating how much space could be recovered by archiving or deleting mulle directories.

Command Purpose
du -sh directory Show one human-readable total for a directory
du -h directory Show usage for the directory and its subdirectories
du -h --max-depth=1 directory Show one level of directory usage on GNU/Linux
du -h -d 1 directory Show one level of directory usage on BSD/macOS
du -sh * Show totals for items in the current directory

Results from du can differ from apparent file sizes shown by ls -lh because du reports allocated disk blocks. Sparse files, compression, snapshots, hard links, and filesystem metadata can affect what is actually consumed on disk. For cleanup work, du is usually the more useful measurement because it reflects real filesystem usage rather than just nominal file length.

Checking Available Inodes

Free disk space is not the only limit that can stop a Linux or Unix filesystem from accepting new files. Most traditional filesystems also have a fixed or managed pool of inodes, which are metadata records used to describe files, directories, symlinks, device nodes, and other filesystem objects. If the inode pool is exhausted, commands may fail with messages such as No space left on device even when df -h still shows gigabytes of available storage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use df -i to check inode availability across mounted filesystems. This displays the total inode count, used inodes, free inodes, and percentage used for each filesystem:

df -i

Typical output looks like this:

Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda2 6553600 412850 6140750 7% /
/dev/sdb1 13107200 982114 12125086 8% /var
tmpfs 999248 912 998336 1% /run

The IUse% column is the quickest indicator to scan. A filesystem at or near 100% inode usage cannot create more directory entries, even if the Avail column from df -h still looks healthy. This commonly happens on partitions that store huge numbers of small files, such as mail queues, package caches, application session directories, CI build workspaces, container overlay storage, or web cache directories.

Human-readable inode checks for one filesystem

To inspect a specific mount point or directory, pass it to df -i. The command reports the filesystem that contains that path, not only that directory’s own contents:

df -i /var
df -i /var/log
df -i /home

For a compact view, combine inode and space checks for the same path:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

df -h /var
df -i /var

This helps distinguish between byte exhaustion and inode exhaustion. For example, if df -h /var shows 42% used but df -i /var shows 99% used, cleanup should focus on reducing file count rather than deleting only the largest files.

Finding directories with many files

When inode usage is high, the next task is to locate directories containing large numbers of entries. A practical starting point is to count directory entries under common problem areas:

find /var -xdev -type f | wc -l
find /tmp -xdev | wc -l
find /home -xdev -type f | wc -l

The -xdev option keeps find on the same filesystem, which prevents accidentally crossing into mounted backups, network filesystems, or container mounts. To list top-level directories under /var by approximate file count, use:

for d in /var/*; do
[ -d "$d" ] && printf "%10s %s\n" "$(find "$d" -xdev -type f 2>/dev/null | wc -l)" "$d"
done | sort -nr | head

For a deeper view, count files per immediate subdirectory in a suspected location such as a cache or spool directory:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

find /var/cache -xdev -mindepth 1 -maxdepth 1 -type d -exec sh -c '
for d do
printf "%10s %s\n" "$(find "$d" -xdev -type f 2>/dev/null | wc -l)" "$d"
done
' sh {} + | sort -nr | head

Common cleanup targets

  • Package caches: old downloaded packages under locations such as /var/cache.
  • Temporary files: stale files in /tmp or application-specific temp directories.
  • Mail and job queues: accumulated files under /var/spool.
  • Application sessions: many small session files created by web applications.
  • Container storage: unused images, stopped containers, and overlay layers.

On filesystems such as ext4, inode density is usually set when the filesystem is created, so a full inode table cannot be expanded easily in place. Long-term fixes may include deleting stale small files regularly, moving high-file-count workloads to a separate filesystem, changing application retention settings, or recreating the filesystem with inode settings better suited to the workload.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Identifying Large Files and Disk Usage Hotspots

After checking overall filesystem capacity with df and measuring directory usage with du, the next step is usually to locate the files and subdirectories responsible for growth. This is especially useful when a filesystem such as /, /var, /home, or an application data mount is nearly full. The goal is to narrow the search from “this filesystem is full” to “these specific paths are consuming the space.”

A practical first pass is to summarize the largest entries directly under a busy directory. For example, to inspect /var, run du -h --max-depth=1 /var 2>/dev/null | sort -h. This shows each immediate child of /var in human-readable units and sorts the result by size. On systems where GNU du is not available, such as some Unix variants, use du -sk /var/* 2>/dev/null | sort -n to sort by size in kilobytes. Once a large directory appears, repeat the same command inside it, such as du -h --max-depth=1 /var/log 2>/dev/null | sort -h, until the largest consumers are clear.

Finding the Largest Files

To search for large individual files, combine find, ls, and sort. For example, find /var -xdev -type f -size +100M -exec ls -lh {} \; 2>/dev/null lists regular files under /var larger than 100 MB without crossing into other mounted filesystems. The -xdev option is useful when scanning mount points because it keeps the search focused on the filesystem you are trying to clean. To produce a size-sorted list on GNU systems, you can use find /var -xdev -type f -size +100M -printf '%s %p\n' 2>/dev/null | sort -n | tail -20. The first column is the size in bytes, and the last lines show the largest matches.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Log files: Check paths such as /var/log, application log directories, and old rotated logs ending in .gz, .1, or date suffixes.
  • Package caches: Linux systems may accumulate data under /var/cache, including package manager caches.
  • Temporary directories: Inspect /tmp, /var/tmp, and application-specific temp paths for abandoned files.
  • User data: Large downloads, archives, virtual machine images, database dumps, and backups often appear under /home or shared storage mounts.

Disk usage hotspots are not always obvious from file size alone. A deleted file can continue consuming disk space if a running process still has it open. This often happens with logs that were removed manually while the service continued writing to the old file handle. On systems with lsof, run lsof +L1 to list open files with a link count below one. If a large deleted file appears, restarting or reloading the owning service usually releases the space. Use care before stopping production services, especially databases, web servers, and logging agents.

When cleaning up, avoid deleting files solely because they are large. Confirm what owns the data, whether it is still needed, and whether the application has a supported cleanup method. For logs, prefer log rotation or truncation through approved procedures. For caches, use the relevant package manager or application command where available. A safe workflow is to identify the largest directories with du, locate oversized files with find, check for deleted-but-open files with lsof, and then remove, archive, rotate, or move data only after verifying its purpose.

Frequently Asked Questions

What is the quickest command to check free disk space on Linux?

Use df -h to show available and used space for all mounted filesystems in a readable format such as GB or MB. The Avail column shows how much space is still free, and the Use% column shows how full each filesystem is.

How do I check free space for only one directory or mount point?

Run df -h /path/to/directory, such as df -h /var or df -h /home. The command reports the filesystem that contains that path, so it is useful when you need to know whether a specific application directory has space available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What is the difference between df and du?

df reports free and used space at the filesystem level, while du reports how much space files and directories are using. If df -h shows a filesystem is nearly full, use commands like du -sh * or du -h --max-depth=1 /var to find which directories are consuming the space.

How can I find the largest files or directories on a server?

To find large directories, run du -h --max-depth=1 /some/path | sort -hr. To find large files, use a command such as find /some/path -type f -size +500M -exec ls -lh {} \;, adjusting the size threshold as needed.

How do I check whether a filesystem has run out of inodes?

Use df -i to display inode usage for each mounted filesystem. If IUse% is at or near 100%, the filesystem may be unable to create new files even when df -h still shows free disk space.

Bottom Line

Checking free disk space on Linux and Unix is straightforward once you know the right tools: use df -h for filesystem capacity, du -sh for directory usage, and df -i when inode exhaustion may be the problem. These commands give you a quick, practical view of what is full, where space is being used, and whether files or directories are consuming resources unexpectedly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

As a next step, make disk checks part of your regular troubleshooting routine, especially before installs, backups, log rotations, or system updates. If a filesystem is nearly full, identify the largest directories first, clean up safely, and consider adding monitoring so space issues are caught before they disrupt services.

Quick Recap

Bestseller No. 1
Learn How to Use Linux, Linux Mint Cinnamon 22 Bootable 8GB USB Flash Drive - Includes Boot Repair and Install Guide Now with USB Type C
Learn How to Use Linux, Linux Mint Cinnamon 22 Bootable 8GB USB Flash Drive - Includes Boot Repair and Install Guide Now with USB Type C
Linux Mint 22 on a Bootable 8 GB USB type C OTG phone compatible storage; Comes with an easy-to-follow install guide. 24/7 software support via email included.
$22.95

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.