The df command
The df command shows how much space is used and free on each disk…
The df command shows how much space is used and free on each disk; df -h prints the sizes in readable units like G and M.
Taught in Intermediate, lesson 19; more in Ninja
A practice shell in your browser that behaves like bash on Linux for these commands. Nothing you type leaves the page.
Usage
df [OPTION]... [FILE]...
Show how much space is free on each disk. Lists each mounted disk (file system) with its size, the space used and the space left. Name a file or folder to see only the disk it is on. The practice shell has one small disk, the space your browser gives it, so the numbers here are tiny.
How to use df
Free space on every disk
On a real machine you see each disk and partition, with where it is mounted. The practice terminal has one small disk, the space your browser gives it.
df -hFilesystem Size Used Avail Use% Mounted on sandbox 2.0M 10K 2.0M 1% /
The disk a folder is on
df -h ~Filesystem Size Used Avail Use% Mounted on sandbox 2.0M 10K 2.0M 1% /
Count files instead of space: df -i
A disk can also run out of inodes, the slots for files, even with space left.
df -iFilesystem Inodes IUsed IFree IUse% Mounted on sandbox 5000 188 4812 4% /
Options
| -h, --human-readable | sizes like 2.0M or 512G |
|---|---|
| -T, --print-type | add the type of each file system |
| -i, --inodes | count files (inodes) instead of space |
More examples
df -h .Filesystem Size Used Avail Use% Mounted on sandbox 2.0M 10K 2.0M 1% /
Questions about df
What does df stand for?
Disk free: it reports how much space is free on each mounted file system.
Learn it step by step
Related commands
Every everyday command on one page, to print or keep open: the Linux commands cheat sheet.