df
df
The df
command in Unix-like operating systems is used to display information about disk space usage on filesystems. It stands for "disk free". Here’s an overview of df
and its common usage:
Overview of df
df
Purpose: df
is used to report the amount of disk space used and available on filesystems mounted in the system.
Availability: df
is a standard command-line utility available on Unix-like systems, including Linux distributions, macOS, and BSD variants.
Common df
Commands and Usage
df
Commands and UsageDisplay Disk Space Usage for All Filesystems:
To display information about all mounted filesystems:
By default,
df
displays information in 1 KB blocks.
Display Disk Space Usage in Human-Readable Format:
To display disk space usage in a more human-readable format (e.g., in kilobytes, megabytes, gigabytes):
The
-h
option (or--human-readable
) converts sizes into a human-readable format.
Display Disk Space Usage for Specific Filesystem:
To display disk space usage for a specific filesystem (e.g.,
/dev/sda1
):Replace
/dev/sda1
with the device or mount point you want to inspect.
Display Filesystem Type:
To display the type of filesystem along with disk space usage:
The
-T
option (or--print-type
) adds a column showing the filesystem type.
Display Inode Usage:
To display inode usage (number of used and available inodes) instead of disk space:
The
-i
option (or--inodes
) switchesdf
to report inode usage instead of disk space.
Display Total Disk Space Usage:
To display the total disk space usage across all filesystems:
The
--total
option provides a summary at the end of the output, showing the total used and available disk space.
Considerations
Reserved Space: By default,
df
shows the amount of disk space available to ordinary users. Some filesystems reserve a percentage of disk space for root user (root-reserved
). This reserved space is not shown as available to normal users.Symbolic Links:
df
does not follow symbolic links. It reports on the filesystem that contains the symlink's target.Performance Impact: Running
df
on large filesystems or with the-i
option for inode information can be resource-intensive.
Alternatives
pydf: A Python-based tool that provides an enhanced and colorful output of disk usage, similar to
df
.Disk Usage Analyzers: Graphical tools like
Baobab
(for GNOME) andFilelight
(for KDE) offer visual representations of disk usage.
Conclusion
df
is a fundamental command-line tool for monitoring disk space usage on Unix-like systems, providing essential information about available storage and filesystem types. It’s useful for managing disk resources, identifying available space, and planning storage allocation.
help
Last updated