coreutils: df invocation
1
1 14.1 ‘df’: Report file system disk space usage
1 ==============================================
1
1 ‘df’ reports the amount of disk space used and available on file
1 systems. Synopsis:
1
1 df [OPTION]... [FILE]...
1
1 With no arguments, ‘df’ reports the space used and available on all
1 currently mounted file systems (of all types). Otherwise, ‘df’ reports
1 on the file system containing each argument FILE.
1
1 Normally the disk space is printed in units of 1024 bytes, but this
1 can be overridden (⇒Block size). Non-integer quantities are
1 rounded up to the next higher unit.
1
1 For bind mounts and without arguments, ‘df’ only outputs the
1 statistics for that device with the shortest mount point name in the
1 list of file systems (MTAB), i.e., it hides duplicate entries, unless
1 the ‘-a’ option is specified.
1
1 With the same logic, ‘df’ elides a mount entry of a dummy pseudo
1 device if there is another mount entry of a real block device for that
1 mount point with the same device number, e.g. the early-boot pseudo
1 file system ‘rootfs’ is not shown per default when already the real root
1 device has been mounted.
1
1 If an argument FILE resolves to a special file containing a mounted
1 file system, ‘df’ shows the space available on that file system rather
1 than on the file system containing the device node. GNU ‘df’ does not
1 attempt to determine the disk usage on unmounted file systems, because
1 on most kinds of systems doing so requires extremely nonportable
1 intimate knowledge of file system structures.
1
11 The program accepts the following options. Also see ⇒Common
options.
1
1 ‘-a’
1 ‘--all’
1 Include in the listing dummy, duplicate, or inaccessible file
1 systems, which are omitted by default. Dummy file systems are
1 typically special purpose pseudo file systems such as ‘/proc’, with
1 no associated storage. Duplicate file systems are local or remote
1 file systems that are mounted at separate locations in the local
1 file hierarchy, or bind mounted locations. Inaccessible file
1 systems are those which are mounted but subsequently over-mounted
1 by another file system at that point, or otherwise inaccessible due
1 to permissions of the mount point etc.
1
1 ‘-B SIZE’
1 ‘--block-size=SIZE’
1 Scale sizes by SIZE before printing them (⇒Block size). For
1 example, ‘-BG’ prints sizes in units of 1,073,741,824 bytes.
1
1 ‘-h’
1 ‘--human-readable’
1 Append a size letter to each size, such as ‘M’ for mebibytes.
1 Powers of 1024 are used, not 1000; ‘M’ stands for 1,048,576 bytes.
1 This option is equivalent to ‘--block-size=human-readable’. Use
1 the ‘--si’ option if you prefer powers of 1000.
1
1 ‘-H’
1 Equivalent to ‘--si’.
1
1 ‘-i’
1 ‘--inodes’
1 List inode usage information instead of block usage. An inode
1 (short for index node) contains information about a file such as
1 its owner, permissions, timestamps, and location on the disk.
1
1 ‘-k’
1 Print sizes in 1024-byte blocks, overriding the default block size
1 (⇒Block size). This option is equivalent to
1 ‘--block-size=1K’.
1
1 ‘-l’
1 ‘--local’
1 Limit the listing to local file systems. By default, remote file
1 systems are also listed.
1
1 ‘--no-sync’
1 Do not invoke the ‘sync’ system call before getting any usage data.
1 This may make ‘df’ run significantly faster on systems with many
1 disks, but on some systems (notably SunOS) the results may be
1 slightly out of date. This is the default.
1
1 ‘--output’
1 ‘--output[=FIELD_LIST]’
1 Use the output format defined by FIELD_LIST, or print all fields if
1 FIELD_LIST is omitted. In the latter case, the order of the
1 columns conforms to the order of the field descriptions below.
1
1 The use of the ‘--output’ together with each of the options ‘-i’,
1 ‘-P’, and ‘-T’ is mutually exclusive.
1
1 FIELD_LIST is a comma-separated list of columns to be included in
1 ‘df’’s output and therefore effectively controls the order of
1 output columns. Each field can thus be used at the place of
1 choice, but yet must only be used once.
1
1 Valid field names in the FIELD_LIST are:
1 ‘source’
1 The source of the mount point, usually a device.
1 ‘fstype’
1 File system type.
1
1 ‘itotal’
1 Total number of inodes.
1 ‘iused’
1 Number of used inodes.
1 ‘iavail’
1 Number of available inodes.
1 ‘ipcent’
1 Percentage of IUSED divided by ITOTAL.
1
1 ‘size’
1 Total number of blocks.
1 ‘used’
1 Number of used blocks.
1 ‘avail’
1 Number of available blocks.
1 ‘pcent’
1 Percentage of USED divided by SIZE.
1
1 ‘file’
1 The file name if specified on the command line.
1 ‘target’
1 The mount point.
1
1 The fields for block and inodes statistics are affected by the
1 scaling options like ‘-h’ as usual.
1
1 The definition of the FIELD_LIST can even be split among several
1 ‘--output’ uses.
1
1 #!/bin/sh
1 # Print the TARGET (i.e., the mount point) along with their percentage
1 # statistic regarding the blocks and the inodes.
1 df --out=target --output=pcent,ipcent
1
1 # Print all available fields.
1 df --o
1
1 ‘-P’
1 ‘--portability’
1 Use the POSIX output format. This is like the default format
1 except for the following:
1
1 1. The information about each file system is always printed on
1 exactly one line; a mount device is never put on a line by
1 itself. This means that if the mount device name is more than
1 20 characters long (e.g., for some network mounts), the
1 columns are misaligned.
1
1 2. The labels in the header output line are changed to conform to
1 POSIX.
1
1 3. The default block size and output format are unaffected by the
1 ‘DF_BLOCK_SIZE’, ‘BLOCK_SIZE’ and ‘BLOCKSIZE’ environment
1 variables. However, the default block size is still affected
1 by ‘POSIXLY_CORRECT’: it is 512 if ‘POSIXLY_CORRECT’ is set,
1 1024 otherwise. ⇒Block size.
1
1 ‘--si’
1 Append an SI-style abbreviation to each size, such as ‘M’ for
1 megabytes. Powers of 1000 are used, not 1024; ‘M’ stands for
1 1,000,000 bytes. This option is equivalent to ‘--block-size=si’.
1 Use the ‘-h’ or ‘--human-readable’ option if you prefer powers of
1 1024.
1
1 ‘--sync’
1 Invoke the ‘sync’ system call before getting any usage data. On
1 some systems (notably SunOS), doing this yields more up to date
1 results, but in general this option makes ‘df’ much slower,
1 especially when there are many or very busy file systems.
1
1 ‘--direct’
1 Do not resolve mount point and show statistics directly for a file.
1 It can be especially useful for NFS mount points if there is a
1 boundary between two storage policies behind the mount point.
1
1 ‘--total’
1 Print a grand total of all arguments after all arguments have been
1 processed. This can be used to find out the total disk size, usage
1 and available space of all listed devices. If no arguments are
1 specified df will try harder to elide file systems insignificant to
1 the total available space, by suppressing duplicate remote file
1 systems.
1
1 For the grand total line, ‘df’ prints ‘"total"’ into the SOURCE
1 column, and ‘"-"’ into the TARGET column. If there is no SOURCE
1 column (see ‘--output’), then ‘df’ prints ‘"total"’ into the TARGET
1 column, if present.
1
1 ‘-t FSTYPE’
1 ‘--type=FSTYPE’
1 Limit the listing to file systems of type FSTYPE. Multiple file
1 system types can be specified by giving multiple ‘-t’ options. By
1 default, nothing is omitted.
1
1 ‘-T’
1 ‘--print-type’
1 Print each file system’s type. The types printed here are the same
1 ones you can include or exclude with ‘-t’ and ‘-x’. The particular
1 types printed are whatever is supported by the system. Here are
1 some of the common names (this list is certainly not exhaustive):
1
1 ‘nfs’
1 An NFS file system, i.e., one mounted over a network from
1 another machine. This is the one type name which seems to be
1 used uniformly by all systems.
1
1 ‘ext2, ext3, ext4, xfs, btrfs...’
1 A file system on a locally-mounted hard disk. (The system
1 might even support more than one type here; Linux does.)
1
1 ‘iso9660, cdfs’
1 A file system on a CD or DVD drive. HP-UX uses ‘cdfs’, most
1 other systems use ‘iso9660’.
1
1 ‘ntfs,fat’
1 File systems used by MS-Windows / MS-DOS.
1
1 ‘-x FSTYPE’
1 ‘--exclude-type=FSTYPE’
1 Limit the listing to file systems not of type FSTYPE. Multiple
1 file system types can be eliminated by giving multiple ‘-x’
1 options. By default, no file system types are omitted.
1
1 ‘-v’
1 Ignored; for compatibility with System V versions of ‘df’.
1
1 ‘df’ is installed only on systems that have usable mount tables, so
1 portable scripts should not rely on its existence.
1
1 An exit status of zero indicates success, and a nonzero value
1 indicates failure. Failure includes the case where no output is
1 generated, so you can inspect the exit status of a command like ‘df -t
1 ext3 -t reiserfs DIR’ to test whether DIR is on a file system of type
1 ‘ext3’ or ‘reiserfs’.
1
1 Since the list of file systems (MTAB) is needed to determine the file
1 system type, failure includes the cases when that list cannot be read
1 and one or more of the options ‘-a’, ‘-l’, ‘-t’ or ‘-x’ is used together
1 with a file name argument.
1