Linux WC command parameters and usage detailed

Source: Internet
Author: User

The function of the WC command is to count the number of bytes, words, and rows in the specified file and display the results to the output.

Syntax: WC [options] File ...

Description: This command counts the number of bytes, words, and lines in a given file. If no file name is given, read from standard input. The WC gives also the president count of all specified documents at the same time. A word is the largest string that is separated by a space character area.

The options for this command have the following meanings:

-C Statistics the number of bytes.

-L statistic line count.

-W counts the number of words.

These options can be used in combination.

The order and number of output columns are not affected by the order and number of options. Always appear in the following order and each item is at most one column.

Number of lines, words, bytes, file names

If there is no file name on the command line, the file name does not appear in the output.

For example:

$ WC-LCW file1 file2

4 file1

7 File2


Omit option-LCW,WC command has the same execution result as above


The WC command is used to compute the number of lines, words, and characters in a file or in a specified number of files. Such as:

WC filename

The first column shows the number of rows, the second column shows the number of words, and the third column shows the number of characters.

WC has four parameters to choose from, namely L,c,m,w

Wc-l FileName Report Line number

wc-c FileName Report byte number

WC-M FileName Report character number

WC-W FileName Report Word number

The command you see today is: Ls-l|wc-l to count the number of files in the current directory

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.