--- df view disk command linux

df

Statistics overall disk space df command lists the file system can be used to view disk usage and free space.

format

df [options] parameters

Note: By default, if you do not add any options, disk space is displayed in units of 1KB.

[root@linus ~]# df		#因为我是使用的xshell连接,所以能够显示中文内容
文件系统                   1K-块    已用     可用 已用% 挂载点
/dev/mapper/centos-root 52403200 4563668 47839532    9% /
devtmpfs                  917604       0   917604    0% /dev
tmpfs                     933524       0   933524    0% /dev/shm
tmpfs                     933524    9288   924236    1% /run
tmpfs                     933524       0   933524    0% /sys/fs/cgroup
/dev/sda1                1038336  182368   855968   18% /boot
/dev/mapper/centos-home 49250820   33052 49217768    1% /home
tmpfs                     186708      12   186696    1% /run/user/42
tmpfs                     186708       0   186708    0% /run/user/0

View in the system, followed by Filesystem, 1K-blocks, Used, Available, Use%, Mounted on

Filesystem: The representative of the file system which partition, lists the device name.
1K-blocks: Description display unit is 1KB, can be used to change the unit -m -h or size, may be provided with -B.
Used: size of the disk space has been used.
Available: the size of the remaining space.
Use%: disk usage. If the utilization rate above 90%, you need to pay attention, to avoid the emergence of system disk capacity shortage problem, especially for file contents increase faster situations (such as / home, / var / spool / mail , etc.).
Mounted on: the disk mounted directory.

Note: You can also use df add a file or directory to see the use of the directory where the disk.

[root@linus ~]# df /etc/
文件系统                   1K-块    已用     可用 已用% 挂载点
/dev/mapper/centos-root 52403200 4564580 47838620    9% /

Options

-a: -all, show all file systems, including the virtual file system
-B: -block-size, specify the size of the unit. For example 1K, 1M etc.
-h: -human-readable, in the most appropriate unit display
-H: -si, -h, and as parameters, but not in 1024, but 1000, i.e. 1k = 1000, instead of 1k = 1024
-i: -inodes, no hard disk capacity, but in the inode number (nodes) to display
-k: KB displays each file system capacity, the equivalent-size = 1K -block
-m: each displayed in KB capacity file system, size = 1M-equivalent -block
the -l: -local, show only the local file system
-no-sync: before using the statistical information does not invoke sync command (default)
-sync: call sync command before using the statistical information
-t: -type = tYPE, display only the specified type of file system
-T: -print-type, displaying the file system type
-x: -exclude-type = tYPE, do not display the specified type of file system

Simple Case

Note: This case just to name a few common options, and the rest on their own practice

[root@linus ~]# df -B g			#指定单位大小为:GB,也可以指定KBMB等
文件系统                1G-块  已用  可用 已用% 挂载点
/dev/mapper/centos-root   50G    5G   46G    9% /
devtmpfs                   1G    0G    1G    0% /dev
tmpfs                      1G    0G    1G    0% /dev/shm
tmpfs                      1G    1G    1G    1% /run
tmpfs                      1G    0G    1G    0% /sys/fs/cgroup
/dev/sda1                  1G    1G    1G   18% /boot
/dev/mapper/centos-home   47G    1G   47G    1% /home
tmpfs                      1G    1G    1G    1% /run/user/0
/dev/sr0                   5G    5G    0G  100% /run/media/ro
[root@linus ~]# df -h			#以合适的单位显示磁盘空间
文件系统                 容量  已用  可用 已用% 挂载点
/dev/mapper/centos-root   50G  4.4G   46G    9% /
devtmpfs                 897M     0  897M    0% /dev
tmpfs                    912M     0  912M    0% /dev/shm
tmpfs                    912M  9.1M  903M    1% /run
tmpfs                    912M     0  912M    0% /sys/fs/cgroup
/dev/sda1               1014M  179M  836M   18% /boot
/dev/mapper/centos-home   47G   33M   47G    1% /home
tmpfs                    183M   44K  183M    1% /run/user/0
/dev/sr0                 4.3G  4.3G     0  100% /run/media/ro
[root@linus ~]# df -T			#显示文件系统类型
文件系统                类型        1K-块    已用     可用 已用% 挂载点
/dev/mapper/centos-root xfs      52403200 4575168 47828032    9% /
devtmpfs                devtmpfs   917604       0   917604    0% /dev
tmpfs                   tmpfs      933524       0   933524    0% /dev/shm
tmpfs                   tmpfs      933524    9252   924272    1% /run
tmpfs                   tmpfs      933524       0   933524    0% /sys/fs/cgroup
/dev/sda1               xfs       1038336  182368   855968   18% /boot
/dev/mapper/centos-home xfs      49250820   33052 49217768    1% /home
tmpfs                   tmpfs      186708      44   186664    1% /run/user/0
/dev/sr0                iso9660   4414592 4414592        0  100% /run/media/root/CentOS 7 x86_64
[root@linus ~]# df -l			#只显示本地文件系统
文件系统                   1K-块    已用     可用 已用% 挂载点
/dev/mapper/centos-root 52403200 4575172 47828028    9% /
devtmpfs                  917604       0   917604    0% /dev
tmpfs                     933524       0   933524    0% /dev/shm
tmpfs                     933524    9252   924272    1% /run
tmpfs                     933524       0   933524    0% /sys/fs/cgroup
/dev/sda1                1038336  182368   855968   18% /boot
/dev/mapper/centos-home 49250820   33052 49217768    1% /home
tmpfs                     186708      44   186664    1% /run/user/0
/dev/sr0                 4414592 4414592        0  100% /run/media/root/CentOS 7 x86_64

Usually we will use these options together, for example:

[root@linus ~]# df -hT				#以合适的单位显示磁盘使用情况,并显示文件系统
文件系统                类型      容量  已用  可用 已用% 挂载点
/dev/mapper/centos-root xfs        50G  4.4G   46G    9% /
devtmpfs                devtmpfs  897M     0  897M    0% /dev
tmpfs                   tmpfs     912M     0  912M    0% /dev/shm
tmpfs                   tmpfs     912M  9.1M  903M    1% /run
tmpfs                   tmpfs     912M     0  912M    0% /sys/fs/cgroup
/dev/sda1               xfs      1014M  179M  836M   18% /boot
/dev/mapper/centos-home xfs        47G   33M   47G    1% /home
tmpfs                   tmpfs     183M   44K  183M    1% /run/user/0
/dev/sr0                iso9660   4.3G  4.3G     0  100% /run/media/root/CentOS 7 x86_64
[root@linus ~]# df -t tmpfs  -h		#指定文件系统为tmpfs,并以合适的单位显示磁盘使用情况
文件系统        容量  已用  可用 已用% 挂载点
tmpfs           912M     0  912M    0% /dev/shm
tmpfs           912M  9.1M  903M    1% /run
tmpfs           912M     0  912M    0% /sys/fs/cgroup
tmpfs           183M   44K  183M    1% /run/user/0
Published 14 original articles · won praise 4 · Views 527

Guess you like

Origin blog.csdn.net/qq_42534026/article/details/103874558