A Linux command in a few days — WC

Time:2021-1-24

WC: the number of lines, words and bytes of the printed file.

Word refers to a sequence of characters whose length is not zero separated by white space characters.

Specific usage:
wc [option] [file]

Common [option]:

  • -c: Print bytes
  • -m: Number of characters printed
  • -l: Print lines
  • -w: Number of printed words
  • -50: The length of the longest line to print (in characters)

[file] can be one or more file names, or - (standard input)

When no options are added, the number of lines, words and bytes are displayed by default. If there are multiple files, they will be summarized and the total number of lines, words and bytes will be displayed in the last line.