df

package
v0.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package df implements the df builtin command.

df — report file system disk space usage

Usage: df [OPTION]...

Show information about the file system on which each FILE resides, or all file systems by default. This implementation does not accept FILE operands; pipe through grep to filter.

Mount enumeration is delegated to the internal diskstats package, which reads /proc/self/mountinfo on Linux and calls getfsstat(2) on macOS. The /proc read is exempt from the AllowedPaths sandbox because the path is hardcoded and never derived from user input — the same documented exception the ss and ip route builtins use.

Accepted flags:

-h, --human-readable
    Print sizes in powers of 1024 (e.g. 1023M, 1.5G).

-H, --si
    Print sizes in powers of 1000 (e.g. 1.1G).

-k
    Use 1024-byte blocks (POSIX default; the column header reads
    "1K-blocks").

-P, --portability
    Use the POSIX output format. Single space-separated header line:
    "Filesystem 1024-blocks Used Available Capacity Mounted on".

-T, --print-type
    Add a column showing the filesystem type.

-i, --inodes
    List inode usage instead of block usage.

-a, --all
    Include pseudo, duplicate, and inaccessible filesystems.

-t, --type=TYPE
    Limit the listing to filesystems of TYPE. May be repeated.

-x, --exclude-type=TYPE
    Exclude filesystems of TYPE. May be repeated. If TYPE is named
    by both -t and -x, exclusion wins.

-l, --local
    Limit the listing to local filesystems.

--total
    Append a grand-total row.

--no-sync
    Accepted as a no-op (this is the default behaviour).

--help
    Print usage to stdout and exit 0.

Rejected flags (intentionally not registered, rejected as unknown by pflag with exit 1):

--sync   — invokes sync(2), modifying kernel buffer state. Violates
           the "no system state mutation" rule.
-B/--block-size, --output, [FILE]…   — deferred to a later version.
-v, --version                        — not meaningful in this shell.

Exit codes:

0  Success — listing was written.
1  Error — unsupported platform, unknown flag, extra operand, or
   failure to enumerate the mount table.

Index

Constants

This section is empty.

Variables

View Source
var Cmd = builtins.Command{
	Name:        "df",
	Description: "report file system disk space usage",
	MakeFlags:   makeFlags,
}

Cmd is the df builtin command descriptor.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL