How to properly use the Linux command –du_linux Shell

Source: Internet
Author: User
Tags disk usage

This article briefly describes how to use the Linux command –du, you need friends can refer to.

Du (disk usage)

Feature Description: Displays the size of the directory or file.

syntax:du [-abcdhhklmssx][-l < symbolic connection >][-x < file >][–block-size][–exclude=< directory or file >][–max-depth= < directory layer >][–help][–version][directory or file]

Supplemental Note: Du displays the disk space occupied by the specified directory or file.

Parameters

A or-all displays the size of individual files 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 individual directories or files.
-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 K,m,g is a unit of conversion in 1000.
-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 totals only.
When-S or –separate-dirs displays the size of an individual 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.

Instance

1, display the directory or file space occupied:

[Root@localhost test]# du
608/test6
308./test4
4/scf/lib
4./scf/service/deploy/product
4./ Scf/service/deploy/info
/scf/service/deploy
/scf/service
4/scf/doc
4/scf/bin
32./ SCF
8/test3
1288.

2. Displays only the directory size of the subdirectory below the current directory and the total size of the current directory, and the bottom 1288 is the total size of the current directory

To display the space occupied by the specified file:

[Root@localhost test]# du Log2012.log-
Log2012.log

3. View the space occupied by the specified directory:

[Root@localhost test]# du SCF
4 scf/lib
4 scf/service/deploy/product
4 scf/service/deploy/info
Scf/service/deploy
scf/service
4 scf/doc
4 scf/bin
SCF

4, show the space occupied by multiple files:

[Root@localhost test]# du log30.tar.gz log31.tar.gz
4 log30.tar.gz
4 log31.tar.gz

shows only the size of the sum:
[ Root@localhost test]# du-s
1288.

[Root@localhost test]# du-s scf scf

[root@localhost test]# CD.
[root@localhost soft]# du-s test
1288 test

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.