Home·Terminal commands

df

Files and directories

Usage

df -h

Reports used and free space per filesystem; a disk can run out of inodes while bytes remain, and only df -i shows that.

Common flags

FlagMeaning
-hReadable sizes instead of blocks
-iShow inode use instead of bytes
-kReport in 1K blocks, the portable form
-TGNU: print the filesystem type. On BSD and macOS -T selects a type
-xGNU: leave out a filesystem type, as in -x tmpfs

Examples

df -h

Free space on every mounted filesystem.

df -i

When space remains but writes still fail, look here.

df -h .

Space on the filesystem holding this directory.

Moving, deleting and finding. Some of these do not ask twice, which is why -i becomes a habit.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does df do?

Reports used and free space per filesystem; a disk can run out of inodes while bytes remain, and only df -i shows that.

Q. How do I type it?

df -h — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

5 are listed here; the full set is in man df. This command sits under Files and directories.

Related commands

man page: man df