Linux View directory Size code

Source: Internet
Author: User
Tags disk usage
The code is as follows Copy Code

Du-b--max-depth 1 | Sort-nr | Perl-pe ' s{([0-9]+)}{sprintf "%.1f%s", $1>=2**30? ($1/2**30, "G"): $1>=2**20? ($1/2**20, "M"): $1>=2**10? ($1/2**10, "K"): ($, "")}e '
DU-SBH *
Ls-lh

Common parameters:

-A or--all displays disk usage for each specified file, or displays the respective disk usage for each file in the directory.

-B or--bytes displays the directory or file size in bytes.

-C or--total displays the sum of all directories or files in addition to the size of the directory or file.

-D or--dereference-args displays the source file size for the specified symbolic connection.

-H or--human-readable to k,m,g to improve the readability of the information.

The-H or--si is the same as the-h parameter, but the k,m,g is in 1000 as the conversion unit instead of 1024.

-K or--kilobytes in 1024 bytes.

-L or--count-links a file that calculates hardware connections repeatedly.

The source file size for the symbol connection specified in the-l< symbol connection > or--dereference< symbol connection > Display option.

-M or--megabytes is in 1MB.

-S or--summarize displays only totals, that is, the current directory size.

When-S or--separate-dirs displays the size of each directory, it does not contain the size of its subdirectories.

-X or--one-file-xystem the file system at the start of the process, and if you encounter a different file system directory, skip.

-x< files > or--exclude-from=< files > specify directories or files in < file >.

--exclude=< directory or File > skips the specified directory or file.

--max-depth=< the directory layer > beyond the specified number of layers, ignored.

--help display Help.

--version Displays version information.

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.