请输入您要查询的百科知识:

 

词条 Df (Unix)
释义

  1. History

  2. Usage

  3. Specification

  4. Example

  5. See also

  6. References

  7. External links

     Manual pages 
{{lowercase}}{{Infobox Software
| name = df
| logo =
| screenshot =
| screenshot size =
| caption =
| developer = AT&T Bell Laboratories
| released = {{Start date and age|1971|11|3}}
| latest release version =
| latest release date =
| operating system = Unix and Unix-like
| genre = Command
| license =
| website =
}}

{{mono|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. {{mono|df}} is typically implemented using the statfs or statvfs system calls.

History

{{mono|df}} first appeared in Version 1 AT&T UNIX. The version of {{mono|df}} bundled in GNU coreutils was written by Torbjorn Granlund, David MacKenzie, and Paul Eggert.[1]

Usage

The Single UNIX Specification specifications for {{mono|df}} are:

{{mono|-k}}

Use 1024-byte units, instead of the default 512-byte units, when writing space figures.

{{mono|-P}}

Use a standard, portable, output format

{{mono|-t}}

If XSI compliant, show allocated space as well{{Dubious|date=May 2010}}

{{mono|-h}}

Display in KB, MB, or GB

{{mono|file}}

Write the amount of free space of the file system containing the specified file

Most Unix and Unix-like operating systems add extra options. The BSD and GNU coreutils versions include {{mono|-h}}, where free space is listed in human readable format, adding units with the appropriate SI prefix (e.g. 10MB), {{mono|-i}}, listing inode usage, and {{mono|-l}}, restricting display to only local filesystems. GNU {{mono|df}} includes {{mono|-T}} as well, listing filesystem type information, but the GNU {{mono|df}} shows the sizes in 1K blocks by default.

Specification

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 {{mono|ls}} and other utilities. This does not mandate that the file system itself be based on 512-byte blocks. The {{mono|-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 {{mono|-k}} option to switch to 1024-byte units was a good compromise. Users who prefer the more logical 1024-byte quantity can easily {{mono|alias}} {{mono|df}} to {{mono|df -k}} without breaking many historical scripts relying on the 512-byte units.

The output with {{mono|-P}} shall consist of one line of information for each specified file system. These lines shall be formatted as follows:

In the following list, all quantities expressed in 512-byte units (1024-byte when -k is specified) shall be rounded up to the next higher unit. The fields are:

{{tag|fs name|o}}

The name of the file system, in an implementation-defined format.

{{tag|total space|o}}

The total size of the file system in 512-byte units. The exact meaning of this figure is implementation-defined, but should include {{tag|space used|o}}, {{tag|space free|o}}, plus any space reserved by the system not normally available to a user.

{{tag|space used|o}}

The total amount of space allocated to existing files in the file system, in 512-byte units.

{{tag|space free|o}}

The total amount of space available within the file system for the creation of new files by unprivileged users, in 512-byte units. When this figure is less than or equal to zero, it shall not be possible to create any new files on the file system without first deleting others, unless the process has appropriate privileges. The figure written may be less than zero.

{{tag|percentage used|o}}

The percentage of the normally available space that is currently allocated to all files on the file system. This shall be calculated using the fraction:

{{sfrac||( + )}}

expressed as a percentage. This percentage may be greater than 100 if {{tag|space free|o}} 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.

{{tag|fs root|o}}

The directory below which the file system hierarchy appear

Example

The following is an example of the output of the df command.

$ df

Filesystem 1024-blocks Free %Used Iused %Iused Mounted on

/dev/hd4 32768 16016 52% 2271 14% /

/dev/hd2 4587520 1889420 59% 37791 4% /usr

/dev/hd9var 65536 12032 82% 518 4% /var

/dev/hd3 819200 637832 23% 1829 1% /tmp

/dev/hd1 524288 395848 25% 421 1% /home

/proc - - - - - /proc

/dev/hd10opt 65536 26004 61% 654 4% /opt

See also

  • List of Unix commands
  • du (Unix)

References

1. ^https://linux.die.net/man/1/df

External links

  • {{man|cu|df|SUS|report free disk space}}

Manual pages

  • [https://www.gnu.org/software/coreutils/manual/html_node/df-invocation.html df] — manual page from GNU coreutils
  • {{man|1|df|OpenBSD|display free disk space}}
  • The df Command – by The Linux Information Project (LINFO)
{{Unix commands}}

2 : Standard Unix programs|Unix SUS2008 utilities

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/25 18:22:10