# How to Check Disk Space in Linux (df and du)

> How to check disk space in Linux with df and du: df -h for filesystem usage, du -sh for directory sizes, finding the largest directories, and the inode check that explains 'full' disks.

- Page URL: https://itinsighthub.com/guides/check-disk-space-linux/
- Markdown variant of this page: append `?format=md` to any URL on this site or send `Accept: text/markdown`.
- Full site index for AI assistants: https://itinsighthub.com/llms.txt
- Full site export: https://itinsighthub.com/llms-full.txt

# How to Check Disk Space in Linux

The two commands that answer "how full is my disk" and "what is using all the space" — `df` and `du` — plus how to find the biggest directories fast.

Published August 29, 2026

The short version: df -h shows free space per filesystem · du -sh /path shows how much a directory uses · find the biggest dirs with du -h --max-depth=1 / | sort -h · check inode exhaustion with df -i.

## df: how full is each filesystem

`df` ("disk free") reports used and available space per mounted filesystem. The `-h` flag makes it human-readable, which is the difference between `490162316` and `468G`.

Filesystem usage, human-readable

```
df -h

# A single filesystem or path
df -h /home

# Show the filesystem type too
df -hT

# Inode usage — the check for 'full' disks that have free space
df -i
```

*The columns of df -h*

| Column | Meaning |
| --- | --- |
| Filesystem | the device or pseudo-device mounted at that point |
| Size / Used / Avail | total, used and available space |
| Use% | percentage used — the number to watch |
| Mounted on | where the filesystem lives in the tree |

## du: what is using the space

Once `df` tells you a filesystem is nearly full, `du` ("disk usage") finds *what* is using it. It sums directory contents recursively, so run it on the narrowest path you can — scanning `/` counts every file on the system.

Directory sizes, from a single folder to the whole tree

```
# Size of one directory, summarized (not a per-file list)
du -sh /var/log

# Size of every item in the current directory
du -sh *

# Largest subdirectories, one level deep, sorted biggest-first
du -h --max-depth=1 /var 2>/dev/null | sort -h

# Top-level directories of the whole system, sorted
du -x -h --max-depth=1 / 2>/dev/null | sort -h
```

Use `-x` (stay on one filesystem) when scanning `/`, otherwise `du` descends into every mounted filesystem and the numbers stop making sense. Redirect errors to `/dev/null` so permission-denied warnings do not drown the useful output.

## Find the biggest files, not just directories

The largest files anywhere under a path

```
# The 20 largest files under /var, biggest last
find /var -type f -printf '%s %p\n' 2>/dev/null | sort -n | tail -20

# Human-readable version
find /var -type f -exec du -h {} + 2>/dev/null | sort -h | tail -20
```

The first form is fast because it uses the file's recorded size directly; the second is human-readable but slower because it stats every file. On a busy production box, prefer the `-printf` form.

## When df says full but there is space

Two classic gotchas produce this. First, **inodes**: a filesystem can run out of directory entries before it runs out of bytes — millions of tiny files, common with mail queues, cache dirs and session stores. `df -i` shows inode use; if `IUse%` is 100% while space remains, that is your answer.

Second, **deleted-but-open files**: on Linux, a process holding a deleted file open keeps its space allocated until the process exits. The space is used but invisible to `du`.

Find processes holding deleted files open

```
# Show deleted files still held open (the 'deleted' marker)
sudo lsof +L1

# The top consumers by size
sudo lsof +L1 | awk '{print $1, $7}' | sort -k2 -nr | head
```

Restarting the owning process releases the space. This is the single most common reason a server shows a full disk that a reboot "mysteriously" fixes.

## Frequently asked questions

**What is the difference between df and du?**

df reports free space per mounted filesystem, from the filesystem metadata. du sums the size of files and directories you point it at. They answer different questions: df says how full the disk is, du says what is using it.

**Why do df and du disagree about used space?**

Because they count differently: du sees only files it can read and misses deleted-but-open files, while df reports allocation from the filesystem. A large df/du gap usually means a process is holding a deleted file open — find it with lsof +L1 and restart the process.

**What is an inode and why does running out matter?**

An inode is the metadata record for a file or directory. A filesystem has a fixed number, so millions of tiny files can exhaust inodes before exhausting bytes. Check with df -i; if IUse% is 100%, delete files even though space looks available.

**Is there an interactive way to explore disk usage?**

Yes — ncdu is a terminal-based, interactive disk-usage viewer you can navigate with arrow keys and delete from directly. Install it (apt install ncdu or dnf install ncdu) and run ncdu /path when you need to drill down quickly.

## Related references

- [Linux disk & storage cheat sheet](https://itinsighthub.com/linux/disk-and-storage/) — df, du, lsblk, mount and friends in context.
- [Find large files in Windows 11](https://itinsighthub.com/guides/find-large-files-windows-11/) — the Windows counterpart.
- [PowerShell: check disk space](https://itinsighthub.com/guides/powershell-get-disk-space/) — the Windows-server equivalent.

---

© 2026 ITInsightHub · [About](https://itinsighthub.com/about/) · [Contact](https://itinsighthub.com/contact/) · [Privacy](https://itinsighthub.com/privacy/)
