Linux wc command parameters and usage details

  
                  

The function of the wc command is to count the number of bytes, words, and lines in the specified file, and display the statistical results.

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, it is read from standard input. Wc also gives the president count for all specified files. A word is the largest string distinguished by a space character.

The options for this command have the following meanings:

- c Count the number of bytes.

- l Count the number of rows.

- w Count the number of words.

These options can be combined.

The order and number of output columns are not affected by the order and number of options. Always display in the following order and up to one column per item.

Number of lines, words, bytes, file name

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 33 file1

7 52 file2

11 11 85 total

Omit option -lcw, the execution result of the wc command is the same as above

Example:

The wc command is used to calculate the number of lines in a file or multiple files specified. The number of words and the number of characters. For example: wc filename The first column shows the number of lines, 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 the number of lines wc -c filename report the number of bytes wc -m filename report the number of characters wc -w filename report the number of words

The command I see today is: ls -l

Copyright © Windows knowledge All Rights Reserved