One linux Command every day (40): wc command

Source: Internet
Author: User

One linux Command every day (40): wc command link: One linux Command every day (1): ls command http://www.bkjia.com/ OS /201210/163049.html#linuxlinuxcommand every day (2): cd command serial (3 ): pwd command Export (4): mkdir command http://www.bkjia.com/ OS /201210/1620.3.html#a linuxcommand every day (5): rm command Export (6): rmdir command http://www.bkjia.com/ OS /201210/164017.h Tml; one linux Command every day (7): mv command running (8): cp command http://www.bkjia.com/ OS /201210/163164.html#a linuxcommand every day (9): touch command running (10): cat command running (11 ): nl command http://www.bkjia.com/ OS /201211/165990.htmla linuxcommand every day (12): more command http://www.bkjia.com/ OS /201211/165994.htmllinuxcommand every day (13): l Ess command restart (14): head command restart (15): tail command http://www.bkjia.com/ OS /201211/168702.htmllinuxcommand every day (16): which command restart (17): whereis command restart (18 ): locate command http://www.bkjia.com/ OS /201211/168895.htmla linuxcommand every day (19): find command overview htt P: // extract (20): exechttp of the find command: // www.bkjia.com/ OS /201211/168901.htmllinuxlinuxcommand every day (21): xargshttp of the find command: // encrypt (22 ): detailed description of the parameters of the find command: http://www.bkjia.com/ OS /201211/168912.htmla linuxcommand every day (23): Linux directory structure (24): Linux file type and extension (25): Linux File Attribute explanation example (26): Use SecureCRT to upload and download files example (27): linux chmod command example (28): tar command http://www.bkjia.com/ OS /201212/172.161.htmllinuxcommand every day (29 ): chgrp command http://www.bkjia.com/ OS /201212/172983.htmla linuxcommand every day (30): chown command http://www.bkjia.com/ OS /201212/173239.htmla Li every day Nux command (31):/etc/group detailed description of fuse (32): gzip command http://www.bkjia.com/ OS /201212/174431.htmllinuxcommand every day (33): df command limit (34): du command limit (35 ): ln command http://www.bkjia.com/ OS /201212/174993.htmla linuxlinuxcommand every day (36): diff command http://www.bkjia.com/ OS /201212/176333.htmllinuxcommand every day (37): date Command arguments (38): cal command http://www.bkjia.com/ OS /201212/176337.htmllinuxcommand (39): grep command http://www.bkjia.com/ OS /201212/177059.html wc (Word Count) command in Linux system function to Count the number of bytes, words, 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.

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.