Linux and Unix df command

Quick links

About df
Syntax
Examples
Related commands
Linux and Unix main page

About df

Report how much free disk space is available for each mount you have.

Syntax

df [OPTION]... [FILE]...

-a, --allinclude dummy file systems
-B, --block-size=SIZEuse SIZE-byte blocks
-h, --human-readableprint sizes in human readable format (e.g., 1K 234M 2G)
-H, --silikewise, but use powers of 1000 not 1024
-i, --inodeslist inode information instead of block usage
-klike --block-size=1K
-l, --locallimit listing to local file systems
--no-syncdo not invoke sync before getting usage info (default)
-P, --portabilityuse the POSIX output format
--syncinvoke sync before getting usage info
-t, --type=TYPElimit listing to file systems of type TYPE
-T, --print-typeprint file system type
-x, --exclude-type=TYPElimit listing to file systems not of type TYPE
--versionoutput version information and exit

Examples

df

In the above example when performing just the df command with no additional switches or specification of the file or directory you would get a listing of all file systems and their used and available space.

df -h

The above command is one of the most commonly used commands as it displays the sizes in an easy to read format as shown in the below example.

FilesystemSizeUsedAvailUse%Mounted on
/dev/hda2 28G 7.6G 19G29%/
tmpfs 252M 0252M0%/lib/init/rw
tmpfs252M0252M0%/dev/shm
/dev/hda1464M 37M403M 9% /boot
/dev/hda38.3G429M 7.5G6%/var
nfs6:/home 520G461G60G89%/home
mirrors:/mirrors1.4T1.1T233G83% /mirrors
/dev/mapper/big-phat  77G36G42G46% /space
mailstore:/var/mail9.9G4.8G4.7G 51%/var/mail

df -b public_html

In the above example this command would display the amount of free space in the public_html directory. Below is an example of the output may display when performing this command.

Filesystem                    avail
nfs.computerhope.com:/home 10068252

Related commands

du
find
ls