Linux View directory size and number of files method

Source: Internet
Author: User


View current directory Size:

The code is as follows Copy Code


[root@512m50g/]# Du-sh

To view the specified directory size:

The code is as follows Copy Code


[root@512m50g/] #du-sh/var/www.111cn.net/blog

To view the total number of current directory files:

The code is as follows Copy Code


[root@512m50g/] #find. -type F |wc-l

To view the total number of specified directory files:

The code is as follows Copy Code


[root@512m50g/] #find/var/www.111cn.net/blog-type f |wc-l

To view the total number of directories in the current directory:

The code is as follows Copy Code


[root@512m50g/]# Find. -type D |wc-l

To view the total number of directories in the specified directory:

The code is as follows Copy Code


[root@512m50g/]# find/var/www.111cn.net/blog-type D |wc-l

Du-sh file or directory name

Usage: du [options] ... [File] ...

Summarize the amount of disk used in each < file >, and take the total amount of the catalogue.

Parameters that must be used with long options are also required when using short options.

-A,--all write counts for all files, not just directories

-B,--block-size=size use size-byte blocks

-B,--bytes print size in bytes

-C,--total produce a grand total

-D,--dereference-args dereference FILEs that are symbolic links

-H,--human-readable the file size in an Easy-to-understand format (e.g. 1K 234M 2G)

-H,--si is similar to-H, but takes 1000 of the second party instead of 1024

-K is--block-size=1k

-L,--count-links the size of a hard link is also counted

-L,--dereference find the true destination of any symbolic link indication

-S,--separate-dirs does not include the amount of subdirectories

-S,--summarize only calculates the total amount of each parameter in the command column, respectively

-X,--one-file-system skip directories on different filesystems

-X FILE,--exclude-from=file exclude files, match any, and in FILE.

--exclude=pattern exclude files that match pattern.

--max-depth=n Print to a directory (or file, with--all)

Only if it is N or fewer levels below the command

line argument; --max-depth=0 is the same as

--summarize

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.