df: Display a summary of the amount of disk space used and available
August 9th, 2024 1:27 PM Mr. Q Categories: Command
Command: df
The df
(disk free) command displays the amount of disk space used and available on mounted filesystems. It provides an overview of disk space usage across different filesystems.
Sample Commands and Outputs:
df
: Displays the disk space usage of all mounted filesystems. Sample Command and Output:
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 1024000 204800 819200 21% /
/dev/sdb1 2048000 512000 1536000 25% /mnt/data
Description:
Filesystem
: The name of the filesystem.1K-blocks
: Total size of the filesystem in 1K blocks.Used
: Amount of space used.Available
: Amount of space available.Use%
: Percentage of space used.Mounted on
: Mount point of the filesystem.df -h
: Displays disk usage in human-readable format (e.g., KB, MB, GB). Sample Command and Output:
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 1000M 200M 800M 21% /
/dev/sdb1 2000M 500M 1500M 25% /mnt/data
Description:
-h
: Human-readable format, showing sizes in KB, MB, GB, etc.df -a
: Displays all filesystems, including those with 0 blocks. Sample Command and Output:
$ df -a
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 1024000 204800 819200 21% /
tmpfs 1024 0 1024 0% /dev/shm
Description:
-a
: Includes filesystems with 0 blocks in the output.df -T
: Displays the type of each filesystem. Sample Command and Output:
$ df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda1 ext4 1024000 204800 819200 21% /
/dev/sdb1 xfs 2048000 512000 1536000 25% /mnt/data
Description:
-T
: Shows the filesystem type (e.g., ext4, xfs).df -i
: Displays information about inode usage instead of block usage. Sample Command and Output:
$ df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda1 655360 8192 647168 2% /
/dev/sdb1 1310720 4096 1306624 1% /mnt/data
Description:
-i
: Shows inode usage, including the number of inodes used and free.df --total
: Displays a grand total at the end of the output. Sample Command and Output:
$ df --total
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 1024000 204800 819200 21% /
/dev/sdb1 2048000 512000 1536000 25% /mnt/data
total 3072000 716800 2355200 26%
Description:
--total
: Provides a grand total of disk usage at the end of the output.
Note: The df
command is essential for monitoring disk space usage and ensuring that filesystems do not run out of space. The different options allow you to customize the output based on your needs.