Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux Command Learning Manual-df

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Df-[options] [file.]

Function

Check the disk footprint of the file system. You can use this command to get information such as how much space the hard disk is occupied and how much space is left. The df command displays the usage of I nodes and disk blocks by all file systems.

Description

The meanings of the options for this command are as follows:

"- a displays the disk usage of all file systems, including 0 (block) file systems, such as / proc file systems."

-k is displayed in k bytes.

-m displays the results using MBytes

-h increases the readability of the display mode, for example, if it is on G, it will be displayed in G units.

"- I displays I node information, not disk blocks."

-t displays the disk space usage of each specified type of file system.

-x lists disk space usage that is not a specified type of file system (as opposed to the t option).

-T displays the file system type.

If a file or pathname is given, only information about the file system associated with the file is displayed.

Give an example

List the disk space usage of each file system

The input and output are as follows:

$dfFilesystem 1K-blocks Used Available Use% Mounted on/dev/sda1 150837820 8446552 134729068 / varrun 4097572 92 40974801% / var/runvarlock 4097572 0 4097572 0% / var/lockudev 4097572 32 4097540% / devdevshm 4097572 0 4097572 0% / dev/shmlrm 4097572 44976 4052596 2% / lib/modules/2.6.24-22-generic/volatile192.168.2.5:/store/home 2399169216 323220096 1954078368 15% / home

Here, the first column of the output list is the pathname of the device file corresponding to the file system (usually the partition on the hard disk); the second column shows the number of blocks (1024 bytes) contained in the partition; and the third and fourth columns represent the number of blocks used and available, respectively. Users may find it strange that the sum of the number of blocks in column 3 and 4 is not equal to the number of blocks in column 2. This is because each partition by default leaves a small amount of space for the system administrator to use. Even if the normal user space is full, the administrator can still log in and leave the workspace needed to solve the problem. The Use% column in the list represents the percentage of normal user space used, and even if this number reaches 100%, the partition still has space for the system administrator. Finally, the Mounted on column represents the mount point of the file system.

In addition, the practice found that: if there is no mount will also display information, but the display is almost unused, the meaning of the information is unclear, but certainly not the remaining space used; after mount, if you do not enter the mount point and not mount the result is the same; when the mount has also entered the mount point, then use df / dev/sda* to display the correct information.

Lists the disk space usage of all file systems

The input and output are as follows:

$df-aFilesystem 1K-blocks Used Available Use% Mounted on/dev/sda1 150837820 8446596 134729024 / proc 134729024-/ proc/sys 2000-/ sysvarrun 4097572 92 40974801 per cent / var/runvarlock 4097572 0 4097572 / var/lockudev 4097572 32 4097540 / devdevshm 4097572 0 4097572 0 4097572 / dev/shmdevpts 0 0-/ dev/ptslrm 4097572 44976 40525962 / lib/modules / 2.6.24-22-generic/volatile192.168.2.5:/store/home 2399169216 323220192 1954078304 / homesecurityfs 1954078304-/ sys/kernel/security

Here, the output includes 0 (block) file systems, such as / proc file systems.

More amicably list the disk space usage of all file systems

The input and output are as follows:

$df-ahFilesystem Size Used Avail Use% Mounted on/dev/sda1 144G 8.1G 129G 6% / proc 000-/ proc/sys 000-/ sysvarrun 4.0G 92K 4.0G 1% / var/runvarlock 4.0G 0 4. 0G 0% / var/lockudev 4.0G 32K 4.0G 1% / devdevshm 4.0G 04.0G 0% / dev/shmdevpts 000-/ dev/ptslrm 4.0G 44M 3.9G 2% / lib/modules/2.6.24-22-generic/volatile192.168.2. 5:/store/home 2.3T 309G 1.9T 15% / homesecurityfs 000-/ sys/kernel/security

Here, it can be seen that the output is more friendly and more readable after having the right units.

List the I node usage of each file system

The input and output are as follows:

$df-iaFilesystem Inodes IUsed IFree IUse% Mounted on/dev/sda1 19169280 279092 18890188 / proc 0 18890188-/ proc/sys 000-/ sysvarrun 1024393 57 10243336% / var/runvarlock 1024393 1 1024392 / var/lockudev 1024393 2760 1021633 1 per cent / devdevshm 1024393 1 10243921 per cent / dev/shmdevpts 0 1024392-/ dev/ptslrm 1024393 14 10243779 1 per cent / lib/modules/2.6.24-22-generic/volatile192.168.2.5:/store/home 304676864 9339216 295337648 / homesecurityfs 0 295337648-/ sys/kernel/security

Here, if you use df-I, you should not output lines such as / proc with 0 Inodes.

List the types of file systems

The input and output are as follows:

$df-TFilesystem Type 1K-blocks Used Available Use% Mounted on/dev/sda1 ext3 150837820 8446628 134728992 / varrun tmpfs 4097572 92 4097480% / var/runvarlock tmpfs 4097572 0 4097572 0 134728992 / var/lockudev tmpfs 4097572 32 4097540% / devdevshm tmpfs 4097572 04097572 0 4097572 Tmpfs 4097572 44976 4052596 2 per cent / lib/modules/2.6.24-22-generic/volatile192.168.2.5:/store/home nfs 2399169216 323220352 1954078112 15 per cent / home

Here, you can find the addition of the Type column.

List the usage of file systems of this type ext3

The input and output are as follows:

$df-t ext3Filesystem 1K-blocks Used Available Use% Mounted on/dev/sda1 150837820 8446636 134728984 6 /

Here, only the usage of the ext3 type file system is listed.

List the file system usage except the ext3 class

The input and output are as follows:

$df-x ext3Filesystem 1K-blocks Used Available Use% Mounted onvarrun 4097572 92 4097480 / var/runvarlock 4097572 0 4097572 / var/lockudev 4097572 32 4097540% / devdevshm 4097572 0 4097572 0 4097480 / dev/shmlrm 4097572 44976 4052596 per cent / lib/modules/2.6.24-22-generic/volatile192.168.2.5:/store/home 2399169216 323220480 1954078016 15 per cent / home

The usage of ext3 type file systems is not listed here.

Other

Main reference material: http://fanqiang.chinaunix.net/a1/b1/20010508/133026.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report