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

The usage of the Linux basic command df

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "the usage of the Linux basic command df". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the usage of the basic Linux command df.

Df

Displays the disk usage on the disk partition, showing the file system name, size, mount point, and other information. Df displays the disk space available on the file system that contains each filename parameter. If the file name is not given, the space available on all currently mounted file systems is displayed. By default, disk space is displayed in 1K blocks, unless the environment variable POSIXLY_RIDER is set, in which case 512 byte blocks are used.

If the parameter is the absolute file name of the disk device node that contains the mounted file system, df displays the free space on that file system instead of the file system that contains the device node (which is always the root file system). The various systems that do so require a very non-portable knowledge of file system structure.

The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Df [OPTION]... [FILE]...

2. List of options

Option

Description

-- help

Help

-- version

Display command version information

-a |-- all

Displays all file systems, including virtual file systems

[file]

Displays the file system information on which the specified file is located

-B |-- block-size=SIZE

Set the block size for display

-- direct

Displays statistics for the file instead of the mount point

-- total

Produce a sum

-h |-- human-readable

Display in a more readable way

-H |-- si

Display in a more readable way, but use 1000 as a unit instead of 1024

-I |-- inodes

Display inode information

-k

Equivalent to "--block-size=1k"

-l |-- local

Show local file system

-- no-sync

Do not wake up synchronization before getting usage information

-- sync

Wake up synchronization before getting information

-P |-- portability

Use POSIX output format

-t |-- type=TYPE

Displays file system information of the specified type

-T |-- print-type

Show file system type

-x |-- exclude-type=TYPE

Does not display the specified file system

The values displayed in this directive are in "--block-size", "DF_BLOCK_SIZE", "BLOCK_SIZE", and "BLOCKSIZE". This is the first of the four values available. Except for the first value that is set by the user, the other three are environment variables. If none of these four values are available, the default is 1024 (512 if POSIXLY_CORRECT is set).

The unit displayed may be: KB,1000;K,1024;MB,100*100;M,1024*1024.

3. Examples

1) use the "- h" option to display file system information in a convenient way

[root@localhost] # df-h

/ / File system name size used percentage available mount point

Filesystem Size Used Avail Use% Mounted on

/ dev/mapper/VolGroup-lv_root 25G 13G 11G 56% /

Tmpfs 811M 292K 810m 1% / dev/shm

/ dev/sda1 485M 33M 427M 8% / boot

2) use the "- T" option to show the type of file system

[root@localhost] # df-T

/ / File system name type size has been used percentage available mount point

Filesystem Type 1K-blocks Used Available Use% Mounted on

/ dev/mapper/VolGroup-lv_root ext4 25552764 13364332 10890412 56%

Tmpfs tmpfs 829656 292 829364 / dev/shm

/ dev/sda1 ext4 495844 32996 437248 8% / boot

3) use the "- B" option to specify that the block size for display is 2048kb. Note that the results can be compared with the above.

[root@localhost] # df-B 2048

/ / File system name type size has been used percentage available mount point

Filesystem Type 2K-blocks Used Available Use% Mounted on

/ dev/mapper/VolGroup-lv_root ext4 12776382 6682164 5445208 56%

Tmpfs tmpfs 414828 146 414682 / dev/shm

/ dev/sda1 ext4 247922 16498 218624 8% / boot

4) use the "- t" option to specify that the file system information of type "ext4" is displayed

[root@localhost] # df-t ext4

/ / File system name type size has been used percentage available mount point

/ dev/mapper/VolGroup-lv_root ext4 25552764 13364332 10890412 56%

/ dev/sda1 ext4 495844 32996 437248 8% / boot

At this point, I believe you have a deeper understanding of "the use of the Linux basic command df". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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