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.