Linux Commands | File Management | df Check Disk Usage by Partition
df Command
The df command checks current disk usage by partition.
Syntax
df [options] [file system]
Options
-a,--all: Checks all file systems. It also displays dummy file systems whose size is 0. On some systems, file systems such asignoreorautomay be omitted by default; use this option in that case.-i,--inodes: Displays inode usage information instead of block usage information when checking disk usage by partition. An inode is a special type of disk block that stores information such as file name, owner, permissions, time information, and disk location.-k,--kilobytes: Displays numbers in 1 KB units instead of 512-byte block units.-h,--human: Displays disk usage by partition in easy-to-read units such as bytes, KB, MB, and GB.-P,--portability: Displays output in the POSIX format. This is the same as the original output format except that each file system is shown on one line. If the mount device name is longer than 20 characters, the line may be split; in that case, it may be omitted or shortened.-T,--print-type: Displays the file system type along with disk usage. Use the following two options when you want information for a specific file system type.-t,--type=fstype: Checks disk usage only for a specific file system type.-x,--exclude-type=fstype: Checks disk usage while excluding a specific file system type.-v: Ignored for compatibility with the System V version ofdf.--help: Displays help and exits.--version: Displays version information and exits.
Useful Options
-a/--all: Includes entries whose file size is 0.-l/--local: Shows only local file systems.-h/--human-readable: Shows sizes in human-readable units.
df Command Examples
Example
Display the current server’s disk usage by partition in Kbyte units.
df -k
Display the current server’s disk usage by partition in easy-to-read units.
df -h
Display disk usage along with the file system type.
df -T
Check disk usage only for a specific file system type.
df -t ext4
Usage Example
$ df
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
/dev/disk0s2 1365813704 960084640 405217064 71% 120074578 50652133 70% /
devfs 367 367 0 100% 636 0 100% /dev
map -hosts 0 0 0 100% 0 0 100% /net
map auto_home 0 0 0 100% 0 0 100% /home
/dev/disk0s4 97652728 78802584 18850144 81% 130083 9473165 1% /Volumes/BOOTCAMP