On this page
reference
2 min read
df
df — "disk free" — reports, for each file system, how much space it has and how much is still available.
df [options] [file...]
With no arguments, df reports on every mounted file system. Given a file, it reports on the one file system that file lives on.
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 456G 198G 235G 46% /
/dev/sda1 511M 12M 499M 3% /boot
The default columns
Each line is one file system:
- Filesystem — the device or source backing it.
- Size — its total capacity.
- Used — space in use.
- Avail — space still available.
- Use% — used space as a percentage.
- Mounted on — where it is attached in the directory tree.
Choosing the units
By default sizes are shown in blocks. These options change that.
| Option | Effect |
|---|---|
-h, --human-readable |
Show sizes with unit suffixes — 456G, 12M — using powers of 1024. |
-H, --si |
Likewise, but using powers of 1000. |
-B, --block-size=SIZE |
Show sizes scaled to SIZE — -BM reports in megabytes. |
-k |
Use 1024-byte blocks. |
Choosing what to report
| Option | Effect |
|---|---|
-a, --all |
Include dummy and otherwise-hidden file systems that df would normally skip. |
-l, --local |
Report only local file systems, skipping network-mounted ones. |
-t, --type=TYPE |
Report only file systems of type TYPE. |
-x, --exclude-type=TYPE |
Report everything except file systems of type TYPE. |
--total |
Add a final line giving the grand total across everything reported. |
Changing the output
| Option | Effect |
|---|---|
-i, --inodes |
Report inode counts — total, used, and free — instead of block space. A file system can run out of inodes while it still has space. |
-T, --print-type |
Add a column showing each file system's type. |
--output[=LIST] |
Replace the default columns with exactly the fields named in LIST. With no list, print every available field. |
-P, --portability |
Use a fixed, simple column layout that does not wrap a long device name onto its own line. |
Sync behaviour
| Option | Effect |
|---|---|
--sync |
Flush pending writes before reading the usage figures, for the most up-to-date numbers. |
--no-sync |
Do not flush first. This is the default and is faster. |
Exit status
| Code | Meaning |
|---|---|
0 |
The report was produced. |
1 |
A failure — for example, a named file does not exist, or the table of file systems could not be read. |
See also
Peios Learn
Built with Trail