Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Df (Unix)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{lowercase}} {{short description|Shell command for reporting available file system space}} {{Infobox software | name = df | logo = | screenshot = Df-example-command-gimp.gif | screenshot size = | caption = Example usage of {{code|df}} | author = [[Ken Thompson]],<br />[[Dennis Ritchie]]<br />([[AT&T Bell Laboratories]]) | developer = Various [[open-source software|open-source]] and [[commercial software|commercial]] developers | released = {{Start date and age|1971|11|3|df=y}} | latest release version = | latest release date = | operating system = [[Unix]], [[Unix-like]] | platform = [[Cross-platform]] | genre = [[Command (computing)|Command]] | license = [[coreutils]]: [[GPLv3+]] | website = }} '''<code>df</code>''', short for '''''d'''isk '''f'''ree'', is a [[shell (computing)|shell]] [[command (computing)|command]] for reporting the amount of available storage space on [[file system]]s on which the [[User (computing)|user]] has read access. {{code|df}} is typically implemented using the {{code|statfs()}} or {{code|statvfs()}} [[system call]]s. The Single Unix Specification (SUS) specifies that space is reported in blocks of 512 bytes, and that at a minimum, it reports the file system names and the amount of free space. Using 512-bytes as the unit of measure is a historical practice and maintains compatibility with <code>[[ls]]</code> and other commands. Notably, the file system need not be constrained to internally use 512-byte blocks. The {{code|-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 {{code|-k}} option to switch to 1024-byte units was a good compromise. Users who prefer the more logical 1024-byte quantity can use <code>[[Alias (Unix shell)|alias]]</code> to map {{code|df}} to {{code|df -k}} without breaking many historical scripts relying on the 512-byte units. The output with {{code|-P}} consists of one line of information for each specified file system, like: {{angbr|fs name}} {{angbr|total space}} {{angbr|space used}} {{angbr|space free}} {{angbr|percentage used}} {{angbr|fs root}} where: ;{{angbr|fs name}} :The name of the file system, in an implementation-defined format. ;{{angbr|total space}} :The total size of the file system in block size units. The exact meaning of this figure is implementation-defined, but should include {{angbr|space used}}, {{angbr|space free}}, plus any space reserved by the system not normally available to a user. ;{{angbr|space used}} :The total amount of space allocated to existing files in the file system, in block size units. ;{{angbr|space free}} :The total amount of space available within the file system for the creation of new files by [[Privilege (computing)|unprivileged users]], in block size 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. ;{{angbr|percentage used}} :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|{{angbr|space used}}|({{angbr|space used}} + {{angbr|space free}})}} :expressed as a percentage. This percentage may be greater than 100 if {{angbr|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. ;{{angbr|fs root}} :The directory below which the file system hierarchy appears
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)