One linux command every day (40): wc command

Source: Internet
Author: User
Tags touch command
One linux command every day (40): wc 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 A linux command every day (40): wc command link: A 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 One linux command every day (34): du command http://www.2cto.com/os/201212/174701.html One linux command (35) every day: ln command http://www.2cto.com/os/201212/174993.html One linux command (36) every day: diff command http://www.2cto.com/os/201212/176333.html One linux command (37) every day: date Command http://www.2cto.com/os/201212/176335.html One linux command (38) every day: cal command http://www.2cto.com/os/201212/176337.html One linux command (39) every day: grep command http://www.2cto.com/os/201212/177059.html In Linux, the wc (Word Count) command is used to Count the number of bytes, number of words, and number of lines in a specified file, and display the statistical results. Www.2cto.com 1. command format: wc [option] file... 2. command function: count the number of bytes, number of words, and number of lines in the specified file, and display the statistical result. This command counts the number of bytes, number of words, and number of lines in a specified file. If no file name is provided, it is read from the standard input. Wc also provides the presidential count of the specified file. 3. command parameter:-c counts the number of bytes. -L number of statistics rows. -M: The number of characters. This flag cannot be used with the-c flag. -W counts the number of words. A character is defined as a string separated by blank, skip, or line breaks. -L print the maximum length of a row. -Help: Display help information -- version: Display version information www.2cto.com 4. example: instance 1: view the number of bytes, number of words, and number of lines of the file. Command: wc test.txt output: [root @ localhost test] # cat test.txt hnlinuxpeida. cnblogs. comubuntuubuntu linuxredhatRedhatlinuxmint [root @ localhost test] # wc test.txt 7 8 70 test.txt [root @ localhost test] # wc-l test.txt 7 test.txt [root @ localhost test] # wc-c test.txt 70 test.txt [root @ localhost test] # wc-w test.txt 8 test.txt [root @ localhost test] # Wc-m test.txt 70 test.txt [root @ localhost test] # wc-L test.txt 17 test.txt description: www.2cto.com 7 8 70 test.txt number of rows number of words number of bytes object name Example 2: how to use the wc command to print only the statistics and not the file name? Command: output: [root @ localhost test] # wc-l test.txt 7 test.txt [root @ localhost test] # cat test.txt | wc-l7 [root @ localhost test] # Note: pipe line is used, this is particularly useful when writing shell scripts. Instance 3: used to count the number of files in the current directory. Command: ls-l | wc-l output: [root @ localhost test] # cd test6 [root @ localhost test6] # ll Total 604 --- xr -- r -- 1 root mail 302108 11-30 linklog. log --- xr -- r -- 1 mail users 302108 11-30 log2012.log-rw-r -- 1 mail users 61 11-30 08:39 log2013.log-rw-r -- 1 root mail 0 11-30 08:39 log2014.log-rw-r -- 1 root mail 0 11-30 08:39 log2015.log-rw-r -- 1 root mail 0 11-30 08:39 log2016.log- rw-r -- 1 root mail 0 11-30 08:39 log2017.log [root @ localhost test6] # ls-l | wc-l8 [root @ localhost test6] # description: the quantity contains the current directory.
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.