Linux View file directory size

Source: Internet
Author: User
Tags disk usage

du [-ABCDHHKLMSSX] [-l < Sign connection >][-x < files >][--block-size][--exclude=< directories or files;] [--max-depth=< directory Layer >][--help][--version][directory or file]

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 in k,m,g to improve the readability of the information.

-H or –si is the same as the-h parameter, but K,m,g is converted to 1000 units instead of 1024.

-K or –kilobytes in bytes units.

-L or –count-links repeatedly compute the files for the hardware connection.

-l< symbol connection > or –dereference< symbol connection > Display option the source file size of the symbol connection specified.

-M or –megabytes in 1MB units.

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

-S or –separate-dirs displays the size of each directory without the size of its subdirectories.

-X or –one-file-xystem the file system at the beginning of the processing, if any other different file system directories are skipped.

-x< file > or –exclude-from=< file > in < file > specify directory or file.

–exclude=< directory or File > skip the specified directory or file.

–max-depth=< the number of directory layers > directories that exceed the specified number of layers is ignored.

Help Display Help.

–version Displays version information.

1> to display disk usage for a directory tree and every subtreeDu/home/linux This displays the number of disk blocks in the/home/linux directory and each of its subdirectories.

2> to display the disk usage of a tree and each of its subtrees in 1024-byte unitsDu-k/home/linux This shows the number of 1024-byte disk blocks in the/home/linux directory and each of its subdirectories.

3> Displays the disk usage of a directory tree and each of its subtrees in megabytesDu-m/home/linux This shows the number of MB disk blocks in the/home/linux directory and each of its subdirectories.

4> Displays the disk usage of one directory tree and each subtree in gigabytesDu-g/home/linux This displays the number of GB disk blocks in the/home/linux directory and each of its subdirectories.

5> View the size of all directories and subdirectories under the current directory:Du-h. "." Represents the current directory. can also be replaced by a clear path-h representation with the human form of K, M, G display

6> View the size of the user directory under the current directory, and do not want to see other directories and their subdirectories:Du-sh User-s The summary meaning that only a summarized value is listed du-h--max-depth=0 user--max-depth=n means only deep into the nth-level directory, which is set to 0, meaning that it does not go deep into subdirectories.

7> Lists the size of all directories and files under the user directory and its subdirectories:Du-ah user-a means including directories and files

8> lists the size of the directory in the current directory that does not include the XYZ string:Du-h--exclude= ' *xyz* '

9> want to get more information about the user directory and the size of subdirectories on one screen:du-0h user-0 (bar 0) represents information for each directory that is listed, without wrapping, but directly outputting the information for the next directory.

10> only shows all disk usage for one directory treeDu-s/home/linux 11> View each folder size: Du-h--max-depth=1

Linux View file directory size

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.