Every day, a linux command (34): du command link: A linux command (1): ls command http://www.2cto.com/ OS /201210/163049.html#linuxlinuxcommand (2): cd command quit...
One linux command every day (34): du command link: One linux command every day (1): ls command http://www.2cto.com/os/201210/163049.html ; One linux command every day (2): cd command http://www.2cto.com/os/201210/163050.html ; One linux command every day (3): pwd command http://www.2cto.com/os/201210/163462.html ; One linux command every day (4): mkdir command http://www.2cto.com/os/201210/163463.html ; One linux command every day (5): rm command http://www.2cto.com/os/201210/163662.html ; One linux command (6) every day: rmdir command http://www.2cto.com/os/201210/164017.html ; One linux command (7) every day: mv command http://www.2cto.com/os/201210/164247.html ; One linux command every day (8): cp command http://www.2cto.com/os/201210/164254.html ; One linux command every day (9): touch Command http://www.2cto.com/os/201211/165699.html ; One linux command every day (10): cat command http://www.2cto.com/os/201211/165989.html ; One linux command every day (11): nl command http://www.2cto.com/os/201211/165990.html One linux command every day (12): more command http://www.2cto.com/os/201211/165994.html One linux command every day (13): less command http://www.2cto.com/os/201211/165998.html One linux command every day (14): head Command http://www.2cto.com/os/201211/166191.html One linux command every day (15): tail command http://www.2cto.com/os/201211/168702.html One linux command every day (16): which command http://www.2cto.com/os/201211/168890.html A linux command (17) every day: whereis command http://www.2cto.com/os/201211/168893.html One linux command (18) every day: locate command http://www.2cto.com/os/201211/168895.html One linux command every day (19): find command overview http://www.2cto.com/os/201211/168897.html One linux command every day (20): find command exec http://www.2cto.com/os/201211/168901.html One linux command (21) every day: find command xargs http://www.2cto.com/os/201211/168903.html A linux command (22) every day: detailed description of the parameters of the find Command http://www.2cto.com/os/201211/168912.html A linux command (23) every day: Linux directory structure http://www.2cto.com/os/201211/170430.html One linux command every day (24): Linux file type and extension http://www.2cto.com/os/201211/170431.html One linux command every day (25): Explanation of linux file attributes http://www.2cto.com/os/201211/170434.html One linux command every day (26): use SecureCRT to upload and download files http://www.2cto.com/os/201211/172022.html One linux command every day (27): linux chmod command http://www.2cto.com/os/201211/172028.html One linux command every day (28): tar command http://www.2cto.com/os/201212/172641.html One linux command (29) every day: chgrp command http://www.2cto.com/os/201212/172983.html One linux command every day (30): chown command http://www.2cto.com/os/201212/173239.html A linux command (31) every day:/etc/group file details http://www.2cto.com/os/201212/174429.html One linux command (32) every day: gzip command http://www.2cto.com/os/201212/174431.html One linux command every day (33): df command http://www.2cto.com/os/201212/174434.html The Linux du command is used to view the space used, but unlike the df command, the Linux du command is used to view the space used by files and directory disks, or is there some difference with the df command. 1. command format: www.2cto.com du [option] [file] 2. command function: displays the disk space used by each file and directory. 3. command parameters:-a or-all displays the size of individual files in the directory. -B or-bytes: displays the size of directories or files in bytes. -C or -- total not only displays the size of individual directories or files, but also the total number of all directories or files. -K or -- kilobytes is output in KB (1024 bytes. -M or -- megabytes is output in MB. -S or -- summarize only displays the total, and only lists the last added total value. -H or -- human-readable is in the unit of K, M, and G to improve information readability. -X or -- one-file-xystem is based on the file system at the beginning of processing. if it encounters a different file system directory, it is skipped. Www.2cto.com-L <符号链接> Or -- dereference <符号链接> Displays the source file size of the symbolic link specified in the option. -S or -- separate-dirs displays the size of individual directories in hours without the size of their subdirectories. -X <文件> Or -- exclude-from = <文件> In <文件> Specifies a directory or file. -- Exclude = <目录或文件> Skips the specified directory or file. -D or -- dereference-args displays the source file size of the specified symbolic link. -H or -- si is the same as-h, but K, M, and G are measured in 1000 units. -L or -- count-links repeat the hardware link file. 4. use instance: instance 1: Display directory or space occupied by Files command: du output: [root @ localhost test] # du608. /test6308. /test44. /scf/lib4. /scf/service/deploy/product4. /scf/service/deploy/info12. /scf/service/deploy16. /scf/service4. /scf/doc4. /scf/bin32. /scf8. /test31288. [root @ localhost test] # Note: only the directory size of the subdirectories under the current directory and the total size of the current directory are displayed. the bottom 1288 is the total size of the current directory instance 2: command: du log2012.log output: [root @ localhost test] # du log2012.log 300 log2012.log [root @ local Host test] # Description: www.2cto.com instance 3: view the space occupied by the specified directory. Command: du scf output: [root @ localhost test] # du scf4 scf/lib4 scf/service/deploy/product4 scf/service/deploy/info12 scf/service/deploy16 scf/service4 scf/doc4 scf/bin32 scf [root @ localhost test] # description: example 4: run the command to display space occupied by multiple files: du log30.tar.gz log31.tar.gz output: [root @ localhost test] # du log30.tar.gz log31.tar.gz 4 log30.tar.gz 4 logs [root @ localhost test] # description: instance 5: only show the total size command: du -S output: [root @ localhost test] # du-s1288. [root @ localhost test] # du-s scf32 scf [root @ localhost test] # cd .. [root @ localhost soft] # du-s test1288 test [root @ localhost soft] # Note: instance 6: easy-to-read format display command: du-h test output: [root @ localhost soft] # du-h test608K test/test6308K test/test44.0K test/scf/lib4.0K test/scf/service/deploy/product4.0K test/scf/service/deploy/info12K test/scf/service/deploy16K test/scf/service4. 0 K test/scf/doc4.0K test/scf/bin32K test/scf8.0K test/test31.3M test [root @ localhost soft] # Note: instance 7: commands are displayed for files and directories: output: [root @ localhost soft] # du-ah test4.0K test/log31.tar.gz 4.0 K test/test13.tar.gz 0 test/linklog. log0 test/test6/log2014.log300K test/test6/linklog. log0 test/test6/log2015.log4.0K test/test6/log2013.log300K test/test6/log2012.log0 test/test6/log2017.log0 test/test6/log2016.log608K test/test6 0 test/log2015.log0 test/test4/log2014.log4.0K test/test4/log2013.log300K test/test4/container test/test44.0K test/scf/lib4.0K test/scf/service/deploy/product4.0K test/scf/ service/deploy/info12K test/scf/service/deploy16K test/scf/service4.0K test/scf/doc4.0K test/scf/bin32K test/scf4.0K test/log2013.log300K test/log2012.log0 test/log2017.log0 test /log2016.log4.0K test/log30.tar.gz 4.0 KB test/ Log.tar.bz2 4.0 K test/log.tar.gz 0 test/test3/log2014.log4.0K test/test3/log2013.log8.0K test/test341_k test/scf.tar.gz 1.3 M test [root @ localhost soft] # Note: instance 8: display the size of the disk space occupied by several files or directories, and calculate their total command: du-c log30.tar.gz log31.tar.gz output: [root @ localhost test] # du-c log30.tar.gz log31.tar.gz 4 log30.tar.gz 4 log31.tar.gz 8 total [root @ localhost test] # Note: after the-c option is added, du not only shows the size of disk space occupied by the two directories, but also calculates the sum of these two directories in the last row. Instance 9: sort by space size command: du | sort-nr | more output: [root @ localhost test] # du | sort-nr | more1288. 608. /test6308. /test432. /scf16. /scf/service12. /scf/service/deploy8. /test34. /scf/service/deploy/product4. /scf/service/deploy/info4. /scf/lib4. /scf/doc4. /scf/bin [root @ localhost test] # Note: instance 10: output the Space Command used by each subdirectory in the current directory: du-h -- max-depth = 1 output: [root @ localhost test] # du-h -- max-depth = 1608 K. /test6308K. /test432K. /scf8.0K. /test31.3M. [root @ localhost test] #
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