The DF command for Linux

Source: Internet
Author: User
Tags disk usage

The DF command for Linux

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] desktop]# DF
Filesystem 1k-blocks used Available use% mounted on
/dev/sda2 18208184 6737092 10539508 39%/
Tmpfs 1570280 224 1570056 1%/dev/shm
/DEV/SDA1 289293 33079 240854 13%/boot


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] desktop]# df-i
Filesystem inodes iused IFree iuse% mounted on
/dev/sda2 1164592 148191 1016401 13%/
TMPFS 392570 5 392565 1%/dev/shm
/DEV/SDA1 76912 76873 1%/boot


Description

Example 3: Displaying a specified type of disk

Command:

Df-t EXT4

Output:

[Email protected] desktop]# df-t EXT4
Filesystem 1k-blocks used Available use% mounted on
/dev/sda2 18208184 6737092 10539508 39%/
/DEV/SDA1 289293 33079 240854 13%/boot


Description

Example 4: List I node usage for each file system

Command:

Df-ia

Output:

[Email protected] desktop]# Df-ia
Filesystem inodes iused IFree iuse% mounted on
/dev/sda2 1164592 148191 1016401 13%/
Proc 0 0 0-/proc
Sysfs 0 0 0-/sys
Devpts 0 0 0-/dev/pts
TMPFS 392570 5 392565 1%/dev/shm
/DEV/SDA1 76912 76873 1%/boot
None 0 0 0-/proc/sys/fs/binfmt_misc
Vmware-vmblock 0 0 0-/var/run/vmblock-fuse
Gvfs-fuse-daemon 0 0 0-/ROOT/.GVFS


Description

Example 5: List types of file systems

Command:

Df-t

Output:

[Email protected] desktop]# df-t
Filesystem Type 1k-blocks used Available use% mounted on
/dev/sda2 ext4 18208184 6737092 10539508 39%/
Tmpfs tmpfs 1570280 224 1570056 1%/dev/shm
/DEV/SDA1 ext4 289293 33079 240854 13%/boot


Description

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

Command:

Output:

[Email protected] desktop]# df-h
Filesystem Size used Avail use% mounted on
/dev/sda2 18G 6.5G 11G 39%/
Tmpfs 1.5G 224K 1.5G 1%/DEV/SHM
/DEV/SDA1 283M 33M 236M 13%/boot


[Email protected] desktop]# df-h
Filesystem Size used Avail use% mounted on
/dev/sda2 19G 6.9G 11G 39%/
Tmpfs 1.7G 230k 1.7G 1%/DEV/SHM
/DEV/SDA1 297M 34M 247M 13%/boot


[Email protected] desktop]# DF-LH
Filesystem Size used Avail use% mounted on
/dev/sda2 18G 6.5G 11G 39%/
Tmpfs 1.5G 224K 1.5G 1%/DEV/SHM
/DEV/SDA1 283M 33M 236M 13%/boot


[Email protected] desktop]# df-k
Filesystem 1k-blocks used Available use% mounted on
/dev/sda2 18208184 6737092 10539508 39%/
Tmpfs 1570280 224 1570056 1%/dev/shm
/DEV/SDA1 289293 33079 240854 13%/boot

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

This article is from the "Liang blog" blog, make sure to keep this source http://7038006.blog.51cto.com/7028006/1829032

The DF command for Linux

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.