Linux Learning Note (one-by-one) DF command

Source: Internet
Author: User
Tags disk usage

The function of the DF command in Linux is to check the disk space usage of the Linux server's file system. You can use this command to get information about how much space the hard disk is taking up, and how much space is left.

1. Command format:

DF [Options] [file]

2. Command function:

Displays the free space for the specified disk file. If no file name is specified, all available space for the currently mounted file system will be displayed. By default, disk space is displayed in 1KB, unless the environment variable posixly_correct is specified, which is displayed in 512-byte units

3. Command parameters:

Necessary parameters:

-A All File system list

-h easy to read mode display

-H equals "-H", but the formula, 1k=1000, rather than 1k=1024

-I display inode information

-K block is 1024 bytes

-L show local file system only

-M block is 1048576 bytes

--no-sync Ignore sync command

-P output format POSIX

--sync perform the sync command before obtaining the disk information

-T File system type

Select parameters:

--block-size=< Chunk Size > specified chunk size

-t< file system type > show only disk information for selected file systems

-x< file System type > does not display disk information for the selected file system

--HELP Display Help information

--version displaying version information

4. Usage examples:

Example 1: Displaying disk usage

Command:

Df

Output:

[[email protected] log]# DF

File system 1k-block already used% mount point available

/dev/sda7 19840892 890896 17925856 5%/

/DEV/SDA9 203727156 112797500 80413912 59%/opt

/dev/sda8 4956284 570080 4130372 13%/var

/dev/sda6 19840892 1977568 16839184 11%/usr

/dev/sda3 988116 23880 913232 3%/boot

Tmpfs 16473212 0 16473212 0%/dev/shm

Description

The 1th column of the output list of the DF command in Linux is the pathname of the device file that represents the file system (typically the partition on the hard disk), and the 2nd column gives the number of blocks (1024 bytes) that the partition contains, and the 3rd, 4 columns indicate the number of data blocks used and available respectively. Users may be surprised that 3rd, the sum of 4 column blocks is not equal to the number of blocks in the 2nd column. This is because each of the default partitions leaves a small amount of space for the system administrator to use. The administrator can log in and leave the workspace required to resolve the problem, even when the normal user space is full. The use% column in the list represents the percentage of normal user space used, even if the number reaches 100%, and the partition still leaves room for the system administrator to use. Finally, the mounted on column represents the mount point of the file system.

Case 2: Displaying disk usage in Inode mode

Command:

Df-i

Output:

[Email protected] log]# df-i

File System Inode (i) Used (i) available (i)% mount point used

/dev/sda7 5124480 5560 5118920 1%/

/DEV/SDA9 52592640 50519 52542121 1%/opt

/dev/sda8 1280000 8799 1271201 1%/var

/dev/sda6 5124480 80163 5044317 2%/usr

/dev/sda3 255232 255198 1%/boot

TMPFS 4118303 1 4118302 1%/DEV/SHM

Description

Example 3: Displaying a specified type of disk

Command:

Df-t ext3

Output:

[Email protected] log]# df-t ext3

File system 1k-block already used% mount point available

/dev/sda7 19840892 890896 17925856 5%/

/DEV/SDA9 203727156 93089700 100121712 49%/opt

/dev/sda8 4956284 570104 4130348 13%/var

/dev/sda6 19840892 1977568 16839184 11%/usr

/dev/sda3 988116 23880 913232 3%/boot

Description

Example 4: List I node usage for each file system

Command:

Df-ia

Output:

[Email protected] log]# Df-ia

File System Inode (i) Used (i) available (i)% mount point used

/dev/sda7 5124480 5560 5118920 1%

/proc 0 0 0-/proc

Sysfs 0 0 0-/sys

Devpts 0 0 0-/dev/pts

/DEV/SDA9 52592640 50519 52542121 1%/opt

/dev/sda8 1280000 8799 1271201 1%/var

/dev/sda6 5124480 80163 5044317 2%/usr

/dev/sda3 255232 255198 1%/boot

TMPFS 4118303 1 4118302 1%/DEV/SHM

None 0 0 0-/proc/sys/fs/binfmt_misc

Description

Example 5: List types of file systems

Command:

Df-t

Output:

[Email protected] log]# df-t

File system type 1k-block used available% mount point

/DEV/SDA7 ext3 19840892 890896 17925856 5%/

/DEV/SDA9 ext3 203727156 93175692 100035720 49%/opt

/dev/sda8 ext3 4956284 570104 4130348 13%/var

/dev/sda6 ext3 19840892 1977568 16839184 11%/usr

/dev/sda3 ext3 988116 23880 913232 3%/boot

Tmpfs tmpfs 16473212 0 16473212 0%/dev/shm

Description

Example 6: Display current disk space and usage in an easier-to-read manner

Command:

Output:

[Email protected] log]# df-h

File system capacity has been used with available% mount points

/dev/sda7 19G 871M 18G 5%/

/DEV/SDA9 195G 89G 96G 49%/opt

/dev/sda8 4.8G 557M 4.0G 13%/var

/dev/sda6 19G 1.9G 17G 11%/usr

/dev/sda3 965M 24M 892M 3%/boot

Tmpfs 16G 0 16G 0%/dev/shm

[Email protected] log]# df-h

File system capacity has been used with available% mount points

/dev/sda7 21G 913M 19G 5%/

/DEV/SDA9 209G 96G 103G 49%/opt

/dev/sda8 5.1G 584M 4.3G 13%/var

/dev/sda6 21G 2.1G 18G 11%/usr

/dev/sda3 1.1G 25M 936M 3%/boot

Tmpfs 17G 0 17G 0%/dev/shm

[Email protected] log]# DF-LH

File system capacity has been used with available% mount points

/dev/sda7 19G 871M 18G 5%/

/DEV/SDA9 195G 89G 96G 49%/opt

/dev/sda8 4.8G 557M 4.0G 13%/var

/dev/sda6 19G 1.9G 17G 11%/usr

/dev/sda3 965M 24M 892M 3%/boot

Tmpfs 16G 0 16G 0%/dev/shm

[Email protected] log]# df-k

File system 1k-block already used% mount point available

/dev/sda7 19840892 890896 17925856 5%/

/DEV/SDA9 203727156 93292572 99918840 49%/opt

/dev/sda8 4956284 570188 4130264 13%/var

/dev/sda6 19840892 1977568 16839184 11%/usr

/dev/sda3 988116 23880 913232 3%/boot

Tmpfs 16473212 0 16473212 0%/dev/shm

Description

-H more Current disk space and usage to display in a more readable manner

The-h parameter is the same on the-H root, but at the time of the radical conversion, the capacity is converted by 1000 instead of 1024.

-K displays disk usage in units

-L shows the disk space usage of the local partition, if the server NFS the disk of the remote server, then the system displays the result after the filter NSF drive after adding-l to DF

-I displays the usage of the inode. Linux uses a pointer-like approach to managing disk space mapping. This is also a more critical application

Original link:

Http://www.cnblogs.com/peida/archive/2012/12/07/2806483.html

Linux Learning Note (one-by-one) DF command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.