|
Df or "available disk" (disk free), is used to display the file system's disk usage. By default, the df command will each 1K units display all currently mounted file system, if you want to display the output of the df command to human readable format like this "df -h" -h option.
In this article, we will discuss under 11 different instances df command in Linux.
The basic format in Linux df command is:
#df {options} {mount_point_of_filesystem}
In the df command options available are:
df sample output:
[Root @ linux-world ~] #df
Filesystem1K-blocks UsedAvailableUse% Mounted on
/ Dev / mapper / vg00-root 17003304804668153118525% /
devtmpfs 77187607718760% / dev
tmpfs 77792807779280% / dev / shm
tmpfs 77792885327693962% / run
tmpfs 77792807779280% / sys / fs / cgroup
/ Dev / mapper / vg00-home 1498761641000141622321% / home
/ Dev / sda1 4876526259339536314% / boot
/ Dev / mapper / vg00-var99480124869293709361% / var
/ Dev / mapper / vg00-sap 1498765637636141656361% / sap
[Root @ linux-world ~] #
Example 1: Use the -a option to list all file system disk usage of
When we use the -a option in the df command, which displays all file system disk usage.
[Root @ linux-world ~] # df -a
Filesystem1K-blocks UsedAvailableUse% Mounted on
rootfs 17003304804668153118525% /
proc 000- / proc
sysfs 000- / sys
devtmpfs 77187607718760% / dev
securityfs 000- / sys / kernel / security
tmpfs 77792807779280% / dev / shm
devpts 000- / dev / pts
tmpfs 77792885327693962% / run
tmpfs 77792807779280% / sys / fs / cgroup
cgroup 000- / sys / fs / cgroup / systemd
pstore 000- / sys / fs / pstore
cgroup 000- / sys / fs / cgroup / cpuset
cgroup 000- / sys / fs / cgroup / cpu, cpuacct
cgroup 000- / sys / fs / cgroup / memory
cgroup 000- / sys / fs / cgroup / devices
cgroup 000- / sys / fs / cgroup / freezer
cgroup 000- / sys / fs / cgroup / net_cls
cgroup 000- / sys / fs / cgroup / blkio
cgroup 000- / sys / fs / cgroup / perf_event
cgroup 000- / sys / fs / cgroup / hugetlb
configfs 000- / sys / kernel / config
/ Dev / mapper / vg00-root 17003304804668153118525% /
selinuxfs 000- / sys / fs / selinux
systemd-1000- / proc / sys / fs / binfmt_misc
debugfs 000- / sys / kernel / debug
hugetlbfs 000- / dev / hugepages
mqueue 000- / dev / mqueue
/ Dev / mapper / vg00-home 1498761641000141622321% / home
/ Dev / sda1 4876526259339536314% / boot
/ Dev / mapper / vg00-var99480124869293709361% / var
/ Dev / mapper / vg00-sap 1498765637636141656361% / sap
[Root @ linux-world ~] #
Example 2: The output of the df command to display human readable format
Use the -h option in the df command to output human readable format (for example, 5K, 500M and 5G)
[Root @ linux-world ~] # df -h
FilesystemSizeUsedAvailUse% Mounted on
/ Dev / mapper / vg00-root 17G786M15G5% /
devtmpfs 754M0754M0% / dev
tmpfs 760M0760M0% / dev / shm
tmpfs 760M8.4M752M2% / run
tmpfs 760M0760M0% / sys / fs / cgroup
/ Dev / mapper / vg00-home 15G41M14G1% / home
/ Dev / sda1 477M62M387M14% / boot
/dev/mapper/vg00-var9.5G48M9.0G1%/var
/ Dev / mapper / vg00-sap 15G37M14G1% / sap
[Root @ linux-world ~] #
Example 3: The display space has been used by a particular file system
If we want to show the usage / sap file system space.
[Root @ linux-world ~] # df -h / sap /
FilesystemSizeUsedAvailUse% Mounted on
/ Dev / mapper / vg00-sap 15G37M14G1% / sap
[Root @ linux-world ~] #
Example 4: the output of all types of mounted file systems
-T Option is used in the df command to display the type of file system.
[Root @ linux-world ~] # df -T
FilesystemType1K-blocks UsedAvailableUse% Mounted on
/ Dev / mapper / vg00-root ext4 17003304804668153118525% /
devtmpfs devtmpfs 77187607718760% / dev
tmpfs tmpfs 77792807779280% / dev / shm
tmpfs tmpfs 77792885327693962% / run
tmpfs tmpfs 77792807779280% / sys / fs / cgroup
/ Dev / mapper / vg00-home ext4 1498761641000141622321% / home
/ Dev / sda1 ext3 4876526259339536314% / boot
/ Dev / mapper / vg00-var ext3 99480124869693709321% / var
/ Dev / mapper / vg00-sap ext3 1498765637636141656361% / sap
[Root @ linux-world ~] #
Example 5: Press the block size of the output file system disk usage
[Root @ linux-world ~] # df -k
Filesystem1K-blocks UsedAvailableUse% Mounted on
/ Dev / mapper / vg00-root 17003304804668153118525% /
devtmpfs 77187607718760% / dev
tmpfs 77792807779280% / dev / shm
tmpfs 77792885327693962% / run
tmpfs 77792807779280% / sys / fs / cgroup
/ Dev / mapper / vg00-home 1498761641000141622321% / home
/ Dev / sda1 4876526259339536314% / boot
/ Dev / mapper / vg00-var99480124869693709321% / var
/ Dev / mapper / vg00-sap 1498765637636141656361% / sap
[Root @ linux-world ~] #
inode information output file systems: Example 6
The -i option used in the df command is used to display the file inode information system.
Inode information for all file systems:
[Root @ linux-world ~] # df -i
FilesystemInodesIUsedIFreeIUse% Mounted on
/ Dev / mapper / vg00-root 10895362203110675053% /
devtmpfs 1929693571926121% / dev
tmpfs 19448211944811% / dev / shm
tmpfs 1944824201940621% / run
tmpfs 194482131944691% / sys / fs / cgroup
/ Dev / mapper / vg00-home 960992159609771% / home
/ Dev / sda1 1280163371276791% / boot
/ Dev / mapper / vg00-var64084812356396131% / var
/ Dev / mapper / vg00-sap 960992119609811% / sap
[Root @ linux-world ~] #
Specific file system inode information:
[Root @ linux-world ~] # df -i / sap /
FilesystemInodesIUsedIFreeIUse% Mounted on
/ Dev / mapper / vg00-sap 960992119609811% / sap
[Root @ linux-world ~] #
Example 7: Output all file system usage summary
-total option in the df command to display all file system disk usage summary.
[Root @ linux-world ~] # df -h --total
FilesystemSizeUsedAvailUse% Mounted on
/ Dev / mapper / vg00-root 17G786M15G5% /
devtmpfs 754M0754M0% / dev
tmpfs 760M0760M0% / dev / shm
tmpfs 760M8.4M752M2% / run
tmpfs 760M0760M0% / sys / fs / cgroup
/ Dev / mapper / vg00-home 15G41M14G1% / home
/ Dev / sda1 477M62M387M14% / boot
/dev/mapper/vg00-var9.5G48M9.0G1%/var
/ Dev / mapper / vg00-sap 15G37M14G1% / sap
total 58G980M54G2% -
[Root @ linux-world ~] #
Example 8: Prints only use the local file system disk
Suppose a network file system is also mounted on Linux, but we want to show information about the local file system, which can be done using the -l option df command to achieve.
Print only the local file system:
[Root @ linux-world ~] # df -Thl
FilesystemTypeSizeUsedAvailUse% Mounted on
/ Dev / mapper / vg00-root ext4 17G791M15G6% /
devtmpfs devtmpfs 754M0754M0% / dev
tmpfs tmpfs 760M0760M0% / dev / shm
tmpfs tmpfs 760M8.4M752M2% / run
tmpfs tmpfs 760M0760M0% / sys / fs / cgroup
/ Dev / mapper / vg00-home ext4 15G41M14G1% / home
/ Dev / sda1 ext3 477M62M387M14% / boot
/ Dev / mapper / vg00-var ext3 9.5G105M8.9G2% / var
/ Dev / mapper / vg00-sap ext3 15G37M14G1% / sap
[Root @ linux-world ~] #
Example 9: Print a specific type of file system disk usage
-t option in the df command is used to print a specific file system type, the type -t specify the file system, as follows:
For ext4:
[Root @ linux-world ~] # df -t ext4
Filesystem1K-blocks UsedAvailableUse% Mounted on
/ Dev / mapper / vg00-root 17003304809492153070286% /
/ Dev / mapper / vg00-home 1498761641000141622321% / home
[Root @ linux-world ~] #
For nfs4:
[Root @ linux-world ~] # df-t nfs4
Filesystem1K-blocks UsedAvailableUse% Mounted on
192.168.1.5:/openSUSE 301545472 266833920 19371008 94% / data
[Root @ linux-world ~] #
10 cases: Use the -x option to exclude specific file system type
-x or -exclude-type in the df command to discharge certain file system types in the output.
Suppose we want to print all the outside except ext3 file system.
[Root @ linux-world ~] # df -x ext3
Filesystem1K-blocks UsedAvailableUse% Mounted on
/ Dev / mapper / vg00-root 17003304809492153070286% /
devtmpfs 77187607718760% / dev
tmpfs 77792807779280% / dev / shm
tmpfs 77792885407693882% / run
tmpfs 77792807779280% / sys / fs / cgroup
/ Dev / mapper / vg00-home 1498761641000141622321% / home
192.168.1.5:/opensuse 301545472 266834944 19369984 94% / data
[Root @ linux-world ~] #
Example 11: In the output of the df command to print only a specific field
-output = {field_name1, field_name2 ...} option is used to display the output of the command df certain fields.
The available field names there: source, fstype, itotal, iused, iavail, ipcent, size, used, avail, pcent and target
[Root @ linux-world ~] # df - output = fstype, size, iused
Type1K-blocks IUsed
ext4 1700330422275
devtmpfs 771876357
tmpfs 7779281
tmpfs 777928423
tmpfs 77792813
ext4 1498761615
ext3 487652337
ext3 99480121373
ext3 1498765611
nfs4 301545472451099
[Root @ linux-world ~] # |
|
|
|