df

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunDF

func RunDF(w io.Writer, args []string, opts DFOptions) error

RunDF executes the df command

Types

type DFInfo

type DFInfo struct {
	Filesystem string `json:"filesystem"`
	Type       string `json:"type"`
	Size       uint64 `json:"size"`
	Used       uint64 `json:"used"`
	Available  uint64 `json:"available"`
	UsePercent int    `json:"usePercent"`
	MountedOn  string `json:"mountedOn"`
	// Inode info
	Inodes      uint64 `json:"inodes,omitempty"`
	IUsed       uint64 `json:"iused,omitempty"`
	IFree       uint64 `json:"ifree,omitempty"`
	IUsePercent int    `json:"iusePercent,omitempty"`
}

DFInfo represents disk free space information

func GetDiskFree

func GetDiskFree(path string) (DFInfo, error)

GetDiskFree returns disk space information for a path

type DFOptions

type DFOptions struct {
	HumanReadable bool   // -h: print sizes in human readable format
	Inodes        bool   // -i: list inode information instead of block usage
	BlockSize     int64  // -B: scale sizes by SIZE
	Total         bool   // --total: produce a grand total
	Type          string // -t: limit listing to file systems of given TYPE
	ExcludeType   string // -x: exclude file systems of given TYPE
	Local         bool   // -l: limit listing to local file systems
	Portability   bool   // -P: use POSIX output format
	JSON          bool   // --json: output as JSON
}

DFOptions configures the df command behavior

Jump to

Keyboard shortcuts

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