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

Df command in linux

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Editor to share with you about the df command in linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Df command

Disk management

The df command displays the available disk space on the disk partition. The default display unit is KB. You can use this command to get information such as how much space the hard disk is occupied and how much space is left.

Grammar

Df (option) (parameter)

Option

-an or-- all: contains all file systems

-- block-size=: displays the number of blocks at the specified block size

-h or-- human-readable: displays information in a highly readable manner

-H or-- si: same as the-h parameter, but calculated in 1000 Bytes instead of 1024 Bytes

-I or-- inodes: displays information about inode

-k or-- kilobytes: specify a chunk size of 1024 bytes

-l or-- local: show only local-side file systems

-m or-- megabytes: specify a chunk size of 1048576 bytes

-- no-sync: do not execute the sync instruction before getting the disk usage information. This is the default value.

-P or-- portability: use the output format of POSIX

-- sync: execute the sync instruction before getting disk usage information

-t or-- type=: displays only disk information of the specified file system type

-T or-- print-type: displays the type of file system

-x or-- exclude-type=: do not display disk information of the specified file system type

-- help: show help

-- version: displays version information.

Parameters.

File: specifies a file on the file system.

Example

View the system disk devices. The default is KB:

[root@LinServ-1 ~] # df

File system 1K-Block used available used% mount point

/ dev/sda2 146294492 28244432 110498708 21% /

/ dev/sda1 1019208 62360 904240 7% / boot

Tmpfs 1032204 0 1032204 / dev/shm

/ dev/sdb1 2884284108 218826068 2518944764 8% / data1

Use the-h option to display in units above KB, with high readability:

[root@LinServ-1] # df-h

File system capacity used available used% mount point

/ dev/sda2 140G 27G 106G 21% /

/ dev/sda1 996M 61m 884M 7% / boot

Tmpfs 1009M 0 1009M 0% / dev/shm

/ dev/sdb1 2.7T 209G 2.4T 8% / data1

View all file systems:

[root@LinServ-1] # df-a

File system 1K-Block used available used% mount point

/ dev/sda2 146294492 28244432 110498708 21% /

Proc 0 000-/ proc

Sysfs 0 000-/ sys

Devpts 0 000-/ dev/pts

/ dev/sda1 1019208 62360 904240 7% / boot

Tmpfs 1032204 0 1032204 / dev/shm

/ dev/sdb1 2884284108 218826068 2518944764 8% / data1

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

Here are some practical examples of graphics and text:

Description

Df is the free disk space of disk free and is used to report the disk space usage of the file system.

Related command

Du (disk usage) disk is practical

Free memory information

Getting started example

1.$df

As shown in the figure:

Explanation: df default print information, with K as the block, calculate the total hard disk space, used and available, and the mount point of the file system

2.$df-m

As shown in the figure:

Explanation: change the basic unit of a block

3.$df-T

As shown in the figure:

Explain: print the type of file system

I would like to briefly say that ext is the Linux file extension system, ext2 is the second generation extended file system, and so on, it is already ext4 (independent of ajax's framework extjs)

Help file

Usage: df [option]. [file].

Displays information about the file system on which each file resides, or all file systems by default

The parameters that the long option must use are also necessary when using the short option.

-a,-- all lists all (including virtual file systems)

-B,-- block-size=SIZE specifies the block size

-h,-- human-readable prints in a more readable way (e.g.1K 234m 2G)

-H,-- si ibid., but use powers of 1000 not 1024

-I,-- inodes use information index points instead of blocks to indicate usage

-k like-- block-size=1K specifies that the block size is equal to 1024 bytes to show usage

-l,-- local only shows local file system usage

-- no-sync forbids calling synchronization before getting usage information (default)

-P,-- portability outputs in POSIX format

-- sync calls synchronization before obtaining usage information

-t,-- type=TYPE displays only file systems of the specified type (TYPE)

-T,-- print-type outputs the type of each file system

-x,-- exclude-type=TYPE displays only file systems other than the specified type (TYPE).

-v (ignored)

-- help displays this help and exits

-- version outputs version information and exits

[size] can be the following units (units can be preceded by integers):

KB 1000 and K 1024 MB 1000000 and M 1048576, as well as G, T, P, E, Z, Y.

Example

Df-text3-H

Print only if the file system is ext3 and print in an easy-to-read manner

Wrap up

If one day when the system slows down and you can't find the reason, you might as well take a look at the hard disk space. We once had a project with dozens of gigabytes of log a week. It took us a long time to find out why the system suddenly slowed down.

The above is all the contents of this article "df Command in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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

Development

Wechat

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

12
Report