Linux view directory and file size Du, DF

Source: Internet
Author: User
Tags readable disk usage

Alarm when disk exceeds size

#df View the first-level directory size, usage scale, file system mount point. The file size cannot be displayed. Statistics block usage.

#du View the size of the file and the directory. Statistics file size added. If a hit file is opened, but the file is either RM or MV, but the process of opening the file is not closed, the Du value is updated, but the DF statistic is not updated, and the space is not released, which specifies that the process is updated with the statistical value of DF after kill.


One, DF display file system size and use of

#df Options

Common options:

-h human-readable, file system size is displayed in easy-to-read format such as GB,MB

-T file system type displays filesystem types

[Email protected]_2 home]# df-th

File system type capacity used% mount point available

/dev/mapper/centos-root xfs 18G 6.8G 11G 39%/

Devtmpfs Devtmpfs 481M 0 481M 0%/dev

Tmpfs tmpfs 490M 80K 490M 1%/DEV/SHM

Tmpfs tmpfs 490M 14M 477M 3%/run

Tmpfs tmpfs 490M 0 490M 0%/sys/fs/cgroup

/DEV/SDA1 xfs 497M 169M 329M 34%/boot


Second, du view files and directory disk usage size

#du Options

Common options:

-H human readable, easy-to-read format display

-D--max-depth=1/n If the current directory file and directory are many, and du does not have a parameter query, the current directory file and all subdirectory files are displayed, sometimes too many disadvantages. --MAX-DEPTH Specifies the number of directory layers,--max-depth=1 refers to the current directory.

-S summarize, which only displays summary information for files and subdirectories in the specified directory, does not specifically display the file directory size in subdirectories


Example:

#du-H--max-depth=1/tmp/history/displays only the file and directory sizes in the specified directory and does not display subdirectory content. The total size of the catalog is also displayed

#du-H--max-depth=1/tmp/history/* Displays the files and directories in the specified directory, as well as the file directory size in subdirectories, and does not display the current directory rollup messages.


#du-sh * Displays the size information for all files and directories in the current directory

#du-SH Displays the total size information for the current directory and does not display the size information for files and subdirectories in that directory

#du-sh * |sort-h display all file and subdirectory size information in the current directory and sort by-H readable form

#du-H |cut-d "/"-F 2 Displays the 2nd level of subdirectory information in the current directory and counts the current directory size


Linux view directory and file size Du, DF

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.