df
The df
command is a built-in Linux utility that displays information about the file system disk space usage. It shows the total amount of used, available, and percentage of space used on each file system mounted on your system.
Use cases:
- Checking the disk space usage on a specific file system (e.g.,
/
,/home
,/var
) - Monitoring the available space on a particular partition before running out of room
- Identifying which partitions are almost full, and potentially need maintenance
Syntax:
bash
df [-T] [-h] [file_system]
The options:
-T
: Displays information about each file system type (e.g., ext4, xfs)-h
: Human-readable output with sizes in GB, MB, or KB unitsfile_system
: Specify a specific file system to report on
Special hacks:
- Use
df -h
to get human-readable output for easy visualization of disk space usage. - Use
df -T
to display information about each file system type and size. - To check the disk space usage for a specific directory, use
df -k /path/to/directory
. This will show you the usage statistics for that specific path.
Target audience:
This command is suitable for beginners who want to understand how much free space they have on their Linux system. Intermediate users can use this command to monitor and manage disk space usage, while advanced users might use it as a starting point for more complex analysis using other tools like du
, ncdu
, or btrfs
.
In summary, the df
command is an essential tool for anyone working with Linux file systems, from beginners who need to check their available space to experienced users who want to monitor and manage disk usage.