Original author(s) | Ken Thompson, Dennis Ritchie (AT&T Bell Laboratories) |
---|---|
Developer(s) | Various open-source and commercial developers |
Initial release | November 3, 1971 |
Operating system | Unix, Unix-like |
Platform | Cross-platform |
Type | Command |
License | coreutils: GPLv3+ |
df (abbreviation for disk free) is a standard Unix command used to display the amount of available disk space for file systems on which the invoking user has appropriate read access. df is typically implemented using the statfs or statvfs system calls.
df
for Unix-like systems is part of the X/Open Portability Guide since issue 2 of 1987. It was inherited into the first version of POSIX and the Single Unix Specification. [1] It first appeared in Version 1 AT&T Unix. [2]
The version of df bundled in GNU coreutils was written by Torbjorn Granlund, David MacKenzie, and Paul Eggert. [3] The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities. [4]
The Single UNIX Specification specifications for df are:
df [-k] [-P|-t] [-del] [file...]
Most implementations of df in Unix and Unix-like operating systems include extra options. The BSD and GNU coreutils versions include -h, which lists free space in human readable format displaying units with the appropriate SI prefix (e.g. 10 MB [5] ), -i, which lists inode usage, and -l, restricting display to only local filesystems. GNU df includes -T as well, listing filesystem type information, but the GNU df shows the sizes in 1K blocks by default.
The Single Unix Specification (SUS) specifies by original space is reported in blocks of 512 bytes, and that at a minimum, the file system names and the amount of free space.
The use of 512-byte units is historical practice and maintains compatibility with ls and other utilities. This does not mandate that the file system itself be based on 512-byte blocks. The -k option was added as a compromise measure. It was agreed by the standard developers that 512 bytes was the best default unit because of its complete historical consistency on System V (versus the mixed 512/1024-byte usage on BSD systems), and that a -k option to switch to 1024-byte units was a good compromise. Users who prefer the more logical 1024-byte quantity can easily alias df to df -k without breaking many historical scripts relying on the 512-byte units.
The output with -P consists of one line of information for each specified file system. These lines are formatted as follows:
<fs name>
<total space>
<space used>
<space free>
<percentage used>
<fs root>
In the following list, all quantities expressed in 512-byte units (1024-byte when -k is specified) will be rounded up to the next higher unit. The fields are:
<fs name>
<total space>
<space used>
, <space free>
, plus any space reserved by the system not normally available to a user.<space used>
<space free>
<percentage used>
<space free>
is less than zero. The percentage value shall be expressed as a positive integer, with any fractional result causing it to be rounded to the next highest integer.<fs root>
Example outputs of the df command:
$ df Filesystem 1K-blocks Used Available Use% Mounted onudev 48764976 0 48764976 0% /devtmpfs 9757068 173100 9583968 2% /run/dev/sda2 1824504008 723009800 1008791744 42% /tmpfs 48785328 0 48785328 0% /dev/shmtmpfs 5120 0 5120 0% /run/locktmpfs 48785328 0 48785328 0% /sys/fs/cgroup/dev/sda1 523248 3672 519576 1% /boot/efi$ df -i Filesystem Inodes IUsed IFree IUse% Mounted onudev 12191244 500 12190744 1% /devtmpfs 12196332 702 12195630 1% /run/dev/sda2 115859456 2583820 113275636 3% /tmpfs 12196332 1 12196331 1% /dev/shmtmpfs 12196332 5 12196327 1% /run/locktmpfs 12196332 16 12196316 1% /sys/fs/cgroup/dev/sda1 0 0 0 - /boot/efi$ df -h Filesystem Size Used Avail Use% Mounted onudev 47G 0 47G 0% /devtmpfs 9.4G 170M 9.2G 2% /run/dev/sda2 1.7T 690G 963G 42% /tmpfs 47G 0 47G 0% /dev/shmtmpfs 5.0M 0 5.0M 0% /run/locktmpfs 47G 0 47G 0% /sys/fs/cgroup/dev/sda1 511M 3.6M 508M 1% /boot/efi
In computing, tar is a computer software utility for collecting many files into one archive file, often referred to as a tarball, for distribution or backup purposes. The name is derived from "tape archive", as it was originally developed to write data to sequential I/O devices with no file system of their own. The archive data sets created by tar contain various file system parameters, such as name, timestamps, ownership, file-access permissions, and directory organization.
In computing, ls
is a command to list computer files in Unix and Unix-like operating systems. ls
is specified by POSIX and the Single UNIX Specification. When invoked without any arguments, ls lists the files in the current working directory. The command is also available in the EFI shell. In other environments, such as DOS, OS/2, and Microsoft Windows, similar functionality is provided by the dir
command. The numerical computing environments MATLAB and GNU Octave include an ls
function with similar functionality.
The Filesystem Hierarchy Standard (FHS) is a reference describing the conventions used for the layout of a UNIX system. It has been made popular by its use in GNU/Linux distributions, but it is used by other UNIX variants as well. It is maintained by the Linux Foundation. The latest version is 3.0, released on 3 June 2015.
tmpfs is a temporary file storage paradigm implemented in many Unix-like operating systems. It is intended to appear as a mounted file system, but data is stored in volatile memory instead of a persistent storage device. A similar construction is a RAM disk, which appears as a virtual disk drive and hosts a disk file system.
dd is a command-line utility for Unix, Unix-like operating systems and beyond, the primary purpose of which is to convert and copy files.
wc is a command in Unix, Plan 9, Inferno, and Unix-like operating systems. The program reads either standard input or a list of computer files and generates one or more of the following statistics: newline count, word count, and byte count. If a list of files is provided, both individual file and total statistics follow.
The fstab file is a system configuration file commonly found at /etc/fstab
on Unix and Unix-like computer systems. In Linux, it is part of the util-linux package. The fstab file typically lists all available disk partitions and other types of file systems and data sources that may not necessarily be disk-based, and indicates how they are to be initialized or otherwise integrated into the larger file system structure.
The mtab file is a system information file, commonly found on Unix-like systems.
In computing, cut
is a command line utility on Unix and Unix-like operating systems which is used to extract sections from each line of input — usually from a file. It is currently part of the GNU coreutils package and the BSD Base System.
du
is a standard Unix program used to estimate file space usage—space used under a particular directory or files on a file system. A Windows commandline version of this program is part of Sysinternals suite by Mark Russinovich.
In computing, cmp
is a command-line utility on Unix and Unix-like operating systems that compares two files of any type and writes the results to the standard output. By default, cmp
is silent if the files are the same; if they differ, the byte and line number at which the first difference occurred is reported. The command is also available in the OS-9 shell.
mv is a Unix command that moves one or more files or directories from one place to another. If both filenames are on the same filesystem, this results in a simple file rename; otherwise the file content is copied to the new location and the old file is removed. Using mv requires the user to have write permission for the directories the file will move between. This is because mv changes the content of both directories involved in the move. When using the mv command on files located on the same filesystem, the file's timestamp is not updated.
The seven standard Unix file types are regular, directory, symbolic link, FIFO special, block special, character special, and socket as defined by POSIX. Different OS-specific implementations allow more types than what POSIX requires. A file's type can be identified by the ls -l
command, which displays the type in the first character of the file-system permissions field.
rm
is a basic command on Unix and Unix-like operating systems used to remove objects such as computer files, directories and symbolic links from file systems and also special files such as device nodes, pipes and sockets, similar to the del
command in MS-DOS, OS/2, and Microsoft Windows. The command is also available in the EFI shell.
NILFS or NILFS2 is a log-structured file system implementation for the Linux kernel. It is being developed by Nippon Telegraph and Telephone Corporation (NTT) CyberSpace Laboratories and a community from all over the world. NILFS was released under the terms of the GNU General Public License (GPL).
In computing, sleep is a command in Unix, Unix-like and other operating systems that suspends program execution for a specified time.
The following tables compare general and technical information for a number of file systems.
In computer operating systems, mkfs is a command used to format a block storage device with a specific file system. The command is part of Unix and Unix-like operating systems. In Unix, a block storage device must be formatted with a file system before it can be mounted and accessed through the operating system's filesystem hierarchy.
In Unix-like operating systems, a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files allow an application program to interact with a device by using its device driver via standard input/output system calls. Using standard system calls simplifies many programming tasks, and leads to consistent user-space I/O mechanisms regardless of device features and functions.
cat
is a standard Unix utility that reads files sequentially, writing them to standard output. The name is derived from its function to concatenate files. It has been ported to a number of operating systems.
The Wikibook Guide to Unix has a page on the topic of: Commands |