One day a shell command Linux good housekeeper--disk--DF command detailed _linux Shell

Source: Internet
Author: User
Tags posix readable disk usage

DF command

Disk Management

The DF command is used to display the available disk space on a disk partition. The default display unit is KB. You can use this command to get how much space the hard disk is occupied and how much space is left.

Grammar

DF (options) (parameters)

Options

-A or--all: contains all file systems;
--block-size=< Block Size: Displays the number of blocks in the specified block size;
-H or--human-readable: Display information in a more readable manner;
-H or--si: the same as-H parameter, but in the calculation of 1000 Bytes as the conversion unit instead of 1024 Bytes;
-I or--inodes: Displays information about the inode;
-K or--kilobytes: Specifies a block size of 1024 bytes;
-L or--local: Displays only the local-side file system;
-M or--megabytes: Specifies a block size of 1048576 bytes;
--no-sync: Do not execute the sync instruction before obtaining the disk usage information, this is the preset value;
-P or--portability: using the POSIX output format;
--sync: Before obtaining the disk use information, executes the sync instruction first;
-t< file System type > or--type=< file system type: Displays only disk information for the specified file system type;
-T or--print-type: Displays the type of file system;
-x< file System type > or--exclude-type=< file system type: Do not display disk information for the specified file system type;
--help: Show Help;
--version: Displays version information.

Parameters


File: Specifies the file on the file system.

Instance


to view the system disk devices, which are in kilobytes by default:

[Root@linserv-1 ~]# DF
File system 1k-block already used available% mount point
/dev/sda2 146294492 28244432 110498708 21%/
/DEV/SDA1 1019208 62360 904240 7%/boot
Tmpfs 1032204 0 1032204 0%/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% 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 already used available% mount point
/dev/sda2 146294492 28244432 110498708 21%/
Proc 0 0 0-//proc
Sysfs 0 0 0-/sys
Devpts 0 0 0-/dev/pts
/DEV/SDA1 1019208 62360 904240 7%/boot
Tmpfs 1032204 0 1032204 0%/dev/shm
/DEV/SDB1 2884284108 218826068 2518944764 8%/data1
None 0 0 0-/proc/sys/fs/binfmt_misc

Here are some examples of actual operations:

Description

DF free disk space, which is used to report the use of disk space in the file system

Related commands

Du (disk usage) Diskette utility
Free Memory Information

Getting Started example

1. $df

As shown in figure:

Explanation:DF Default printing information, with K as block, calculate hard disk total space, used and available, and file system mount point

2. $DF –m

As shown in figure:

Explanation: Change the basic unit of a block

3. $DF-T

As shown in figure:

Explanation: Type of file system to print

I briefly describe two lines ext is the Linux file extension system, EXT2 is the second-generation extended file system, and so on, is currently EXT4 (and Ajax framework ExtJS irrelevant)

Help files

Usage: DF [options] ... [File] ...
Displays information about the file system in which each file resides, or, by default, displays all file systems

Parameters that must be used with long options are also required when using short options.
-A,--all list all (including virtual file system)
-B,--block-size=size specifies the block size
-H,--human-readable print in a more readable manner (e.g., 1K 234M 2G)
-H,--si ibid, but use powers of 1000 not 1024
-I,--inodes uses information index points instead of blocks to represent usage conditions
-K-like--block-size=1k specify block size equal to 1024 bytes to display usage
-L,--local only displays local file system usage
--no-sync suppresses call synchronization before obtaining usage information (default)
-P,--portability uses POSIX format output
--sync call synchronization before obtaining usage information
-T,--type=type displays only the file system for the specified type (type)
-T,--print-type output the type of each file system
-X,--exclude-type=type only displays file systems other than the specified type (type).
-V (ignored)
--HELP displays this help information and exits
--version output version information and exit

[Size] can be the following units (preceded by an integer):
KB 1000,k 1024,mb 1000000,m 1048576, and G, T, P, E, Z, Y.

Instance

Df–text3–h

Print only the file system as ext3 and print in readable mode

Closure

If there is a day when the system slows down, and can not find the reason, may wish to look at the hard disk space, we have a project, a week has dozens of G log, was looking for a long time, just think of the system suddenly slowed down the reason.

Related Article

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.