English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
This article briefly introduces how to use the Linux command –du, friends who need it can refer to it.
du (disk usage)
Function description:Displays the size of directories or files.
Syntax:du [-abcDhHklmsSx][-L <symbol link>][-X <file>][–block-size][–exclude=<directory or file>][–max-depth=<number of directory levels>][–help][–version][directory or file]
Supplementary instructions: du will display 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-in bytes when displaying the size of directories or files.
-c or –total displays the size of individual directories or files as well as the total sum of all directories or files.
-D or –dereference-args shows the source file size of the specified symbol link.
-h or –human-readable to improve the readability of information with K, M, G as units.
-H or –si corresponding to-The same as the h parameter, but K, M, G are represented by1000 as the conversion unit.
-k or –kilobytes to represent1024 in bytes.
-l or –count-links recalculates the file for hardware connections.
-L<symbol link> or –dereference<symbol link> shows the source file size of the specified symbol link.
-m or –megabytes1MB as unit.
-s or –summarize Only display the total.
-S or –separate-dirs When displaying the size of individual directories, do not include the size of their subdirectories.
-x or –one-file-xystem Take the file system at the beginning of processing as the standard, and omit other different file system directories if encountered.
-X<file> or –exclude-from=<file> In the <file> specified directory or file.
–exclude=<directory or file> Omit the specified directory or file.
–max-depth=<directory levels> Ignore directories after exceeding the specified level.
–help Display help.
–version Display version information.
Example
1Show the space occupied by directories or files:
[root@localhost test]# du 608 ./test6 308 ./test4 4 ./scf/lib 4 ./scf/service/deploy/product 4 ./scf/service/deploy/info 12 ./scf/service/deploy 16 ./scf/service 4 ./scf/doc 4 ./scf/bin 32 ./scf 8 ./test3 1288 .
2Only show the directory size of the subdirectories under the current directory and the total size of the current directory, the lowest1288For the total size of the current directory
Show the space occupied by the specified file:
[root@localhost test]# du log2012.log 300 log2012.log
3View 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 12 scf/service/deploy 16 scf/service 4 scf/doc 4 scf/bin 32 scf
4Show the space occupied by multiple files:
[root@localhost test]# du log30.tar.gz log31.tar.gz 4 log30.tar.gz 4 log31.tar.gz Only show the total size: [root@localhost test]# du -s 1288 . [root@localhost test]# du -s scf 32 scf [root@localhost test]# cd .. [root@localhost soft]# du -s test 1288 test
That is all for this article, I hope it will be helpful for your learning, and I also hope everyone will support the Yelling Tutorial more.