Linux under DF and du view disk remaining space and folder size

Source: Internet
Author: User

DF-HL View disk remaining space

Du-sm folder

Returns the total m of this folder

More features please view:

DF--help

Du--help

Du-sh (the name of this directory) is the size of this directory.

Use the du command to view a directory, such as viewing the/home/kuuyee directory for disk space size you can use the following command:

# Du/home/kuuyee-sh

There are hundreds of build projects in my home directory, one for the poor look at the directory occupancy is too much trouble. Use the command:

#du/home--max-depth=1-h

That's it. The disk occupancy of all subdirectories is listed! The--max-depth parameter here represents the depth of the directory to be listed, set to 2 if you want to list the level two directory, and so on.

If you want to, the result output to the file can be like this: # du/home--max-depth=1-h > Disk_status.txt

Use df-h to check the partition size of the directory below each root.

Usage: du [options] ... [File] ...
Or: du [option]...–files0-from=f
Summarize the amount of disk used in each < file >, and take the total amount of the catalogue.

The DF command is a Linux system that looks at the file system on a disk partition, and can add parameters to view the disk's remaining space information, in command format:
Df-hl
The display format is:
File system capacity used available% mount point

filesystemsize Used avail use% mounted on
/dev/hda2 45G 19G 24G 44%/
/DEV/HDA1 494M 19M 450M 4%/boot
/dev/hda6 4.9G 2.2G 2.5G 47%/home
/dev/hda5 9.7G 2.9G 6.4G 31%/opt
None 1009M 0 1009M 0%/dev/shm
/dev/hda3 9.7G 7.2G 2.1G 78%/usr/local
/DEV/HDB2 75G 75G 0 100%/
/DEV/HDB2 75G 75G 0 100%/
Take the above output as an example, the meaning of the expression is:

The second hard drive (b) of the HD hard disk interface, the second partition (2), the capacity is 75G, 75G, usable is 0, so utilization is 100% and is mounted on the root partition directory (/).

Example

1 View File size

View all file sizes (including subfolders) under the current folder
Du-sh

# du-h
15M./package
16K./.fontconfig
4.0K./.cache
5.1M./.rpmdb
20M.

View all file sizes (including subfolders) under the specified folder
# du-h FTP
3.8G Ftp/sanya/doc
3.8G Ftp/sanya
4.0K Ftp/testftp/doc
1.4M ftp/testftp
875M ftp/platform/doc/002-Video
27M ftp/platform/doc/001-pdf
5.2M Ftp/platform/doc/bbflash
1.2G ftp/platform/doc/003-Recording
2.1G Ftp/platform/doc
2.1G Ftp/platform
4.0K Ftp/pmo/doc
20K FTP/PMO
36M ftp/uf/doc/innovate-201207
36M Ftp/uf/doc
36M Ftp/uf
446M Ftp/code/doc
446M Ftp/code
6.3G FTP

View the specified file size
# du-h/package/compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm.
184K./package/compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm

View the specified folder size
# DU-HS FTP
6.3G FTP

Total statistics Size

Du-sh xmldb/

DU-SM * | Sort-n//Statistics current directory size and size sort

Du-sk * | Sort-n

Du-sk * | grep GUOJF//Look at the size of a person

du-m | Cut-d "/"-F 2//Look at the text before the second/character

See how many files there are in this folder/*/*/* how many files

Du xmldb/
Du xmldb/*/*/* |wc-l
40752

Explain:
WC [-LMW]

Parameter description:
-L: How many lines
-M: How many characters
-W: how many words

The parameter meaning is as follows:

-S gives only the total number of blocks of data used for each names parameter.
-A recursively displays the number of blocks of data in each file in the specified directory and in the Descendants directory. If-S is not specified or-A is specified, only the number of disk blocks per directory in names and each subdirectory in it is displayed.
-B lists disk space usage in bytes (the system defaults to K bytes).
-k lists disk space usage in 1024-byte units.
-C finally add a total (system default).
-L calculates all file sizes.

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.