Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

df - report free disk space

&pagelevel(4)&pagelevel

You can use df to determine the number of free disk blocks and inodes which are still available at mounted or unmounted local systems and to obtain information on the file system coding (ASCII or EBCDIC).


Syntax


Format 1: df[ -F FSType] -P[ -lV][ -k | -h | -H][ file]
Format 2: df[ -F FSType][ -beglntVv][ -k | -h | -H][ -o ufs_options]...[ file]
Format 3: df -c[ file]...



Format 1: df[ -F FSType] -P[ -lV][ -k | -h | -H][ file]



-F FSType

The file system with which you want to work is of the type FSType. You only need to specify this option if the file system is unmounted.

FSType may be:


ufsBerkeley file system
bs2fsbs2fs file system
procPseudo file system for accessing process data
fdfsPseudo file system for accessing file descriptors


-P

Prints the following information in columns for all mounted file systems or for the specified file systems: 


filesystemSpecial file for the file system
bytesTotal disk space in 512-byte blocks
usedUsed disk space in 512-byte blocks
availableAvailable disk space in 512-byte blocks
capacityPercentage of disk space used
mounted onName of the directory on which the file system is mounted


-l

df prints the number of free blocks and inodes for all locally mounted file systems or for the specified file systems. The -l option is set by default. It cannot be combined with -e or -o.

-V

df expands the df command line and writes the completed command to standard output, but does not execute the command. df completes the command line, adding information derived from /etc/mnttab and /etc/vfstab to input provided by the user.

The added information relates to the option -F FSType and/or the associated special file, depending on which of the two components, if either, was specified on the command line.

If you enter df -V without other options and arguments, you will be shown a list of df command lines indicating all mounted file system types and the associated special file names.

-k

Prints the following information in columns for all mounted file systems or for the specified file systems (like option -P). Storage space is listed in 1024-byte blocks (instead of 512-byte blocks).

The storage space specification takes account of the reserved storage space which can only be used by the POSIX administrator.

-h

This option is equivalent to the -k option except that the sizes are not printed in 1024-byte blocks but in KB (210 bytes), MB (220 bytes), GB (230 bytes) or TB (240 bytes).

-H

This option is equivalent to the -k option except that the sizes are not printed in 1024-byte blocks but in KB (103 Bytes), MB (106 Bytes), GB (109 Bytes) or TB (212 Bytes).

file

file is either the name of a directory or the name of a special file which contains a file system. If you name a directory, df examines the file system mounted on that directory. You may name more than one file.

file not specified:
df prints out information on all mounted file systems or all file systems of type FSType.


Format 2: df[ -F FSType][ -beglntVv][ -k | -h | -H][ -o ufs_options]...[ file]


No option specified

df prints the number of free blocks and inodes in all mounted or all specified file systems.

-F FSType

The file system with which you want to work is of the type FSType. You only need to specify this option if the file system is unmounted.

FSType may be:


ufsBerkeley file system
bs2fsbs2fs file system
procPseudo file system for accessing process data
fdfsPseudo file system for accessing file descriptors
nfsFile system mounted on the remote host (network file system, Berkeley)


-b

Prints the free disk space (in Kbytes). This option cannot be combined with -o.

-e

Prints the number of free inodes. This option cannot be combined with -o, and it overrides the -l option.

-g

Prints the entire statvfs structure for all mounted file systems or for FSType or file. The output consists of 4 lines containing the following information:


dirName of the directory on which the file system is mounted (the string dir does not appear in the output)
deviceAssociated special file (the string device does not appear in the output)
block sizeBlock size of the file system
frag sizeFragment size of the file system
total blocksTotal number of blocks in frag size units
free blocksTotal number of free blocks
availableNumber of free blocks for non-POSIX administrators
total filesTotal number of inodes
free filesNumber of free inodes
filesys idFile system identification number
nameFile system designation (the string name does not appear in the output)
fstypeFile system type
flagFile system flags
filename lengthMaximum length of file names


This option cannot be combined with -o, and it overrides options -b, -e, -k, -l, -n, -r and -v.

-k

Prints the following information in columns for all mounted file systems or for the specified file systems:


filesystemSpecial file associated with the file system
bytesTotal disk space in 1024-byte blocks
usedUsed disk space in 1024-byte blocks
availableAvailable disk space in 1024-byte blocks
capacityPercentage of disk space used
mounted onName of the directory on which the file system is mounted


The storage space specification takes account of the reserved storage space which can only be used by the POSIX administrator.

This option cannot be combined with -o, and it overrides options -b, -e, -k, -l, -n, -r and -v.

-l

df prints the number of free blocks and inodes for all locally mounted file systems or for the specified file systems. The -l option is set by default. It cannot be combined with -e or -o.

-n

df outputs the file system type.

If you combine -n with -o or -f then an error message is displayed.

-t

df prints the number of free blocks and files as well as the total number of available blocks and files for each mounted or specified file system. -t overrides the -b option. Combining -t with -o i produces a totals line for all the columns in the -o i output.

-V

df expands the df command line and writes the completed command to standard output, but does not execute the command. df completes the command line, adding information derived from /etc/mnttab and /etc/vfstab to input provided by the user.

The added information relates to the option -F FSType and/or the associated special file, depending on which of the two components, if either, was specified on the command line.

If you enter df -V without other options and arguments, you will be shown a list of df command lines indicating all mounted file system types and the associated special file names.

-v

df prints the following information in columns for all mounted file systems or for the specified file systems:


Mount DirName of the directory on which the file system is mounted
FilesystemSpecial file associated with the file system
blocksTotal disk space, in 512-byte blocks
usedUsed disk space, in 512-byte blocks
freeFree disk space, in 512-byte blocks
%usedPercentage of disk space used


This option cannot be combined with -o, and it overrides options -b, -e, -k, -l, -n, -r and -v.


-o ufs_options

If the file system type is ufs, you can use a ufs-specific option:


i

df prints the following information in columns:


FilesystemName of the special file
iusedNumber of used inodes
ifreeNumber of free inodes
%iusedPercentage of inodes used
Mounted onName of the directory on which the file system is mounted


The only options with which -o i can be combined meaningfully are -F and -t.


file

file is either the name of a directory or the name of a special file associated with a file system. If you name a directory, df examines the file system mounted on that directory. You may name more than one file.

file not specified:
df examines all locally and remotely mounted file systems or all file systems of type FSType.


Format 3: df -c[ file]...


-c

The command outputs the type of coding (ASCII or EBCDIC) for all locally mounted file systems or those specified with file. This option cannot be combined with other options.


Hint

In UFS file systems the available disk space is as a rule less than the free disk space. The reason for this is that some of the disk space (10%) is reserved for privileged applications and is consequently not available for normal applications.

Error

Some of the following error messages also indicate the correct syntax, but use some syntax elements that differ from the ones in the above description. The table below shows which syntax elements are equivalent:

Syntax element in the error message      Equivalent in the above description

specific_options                         ufs_option

directory | special                      file
generic options                          -begkltvV


df: Cannot access file

An invalid or incomplete special file or directory name was specified with df -V .


df ufs: Usage: df [-F ufs] [generic options] [-o i] [directory|special]

An invalid ufs_option argument was specified with the -o option. ufs_option can only be i.


df: operation not applicable for FSType FStype

An invalid file system type (xxx) was specified for FSType in the command df -F FSType -o i. The only type that can be specified in combination with the -o option is ufs

File

/dev/dsk/*

Special files associated with the file systems

/etc/mnttab

Table of mounted file systems

/etc/vfstab

List of default parameters for each file system

/etc/fs/FStyp/*

Commands for specific file system types

Locale

The following environment variables affect the execution of df:

LANG

Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined.

LC_ALL

If set to a non-empty string value, override the values of all the other internationalization variables.

LC_CTYPE

Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).

LC_MESSAGES

Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.

NLSPATH

Determine the location of message catalogs for the processing of LC_MESSAGES.

Example 1

Printing the associated file system types for all user directories:

$ df -n /h*
/home    : ufs
/home2   : ufs
/home3   : ufs

Example 2

Printing the entire statvfs structure for the file system /stand:

$ df -g /stand
/stand           (/dev/dsk/c0d0s10):     512 block size     512 frag size
  10710 total blocks  7577 free blocks   7577 available      104 total file
    100 free files      10 filsys id                           /stand
    bfs fstype  0x00000000 flag            14 filename length

Example 3

The file system coding is to be output for the /home and /var directories:

$ df -c /home /var
/home    : EBCDIC
/var     : ASCII

See also

du