Linux Command - wc

wc - print newline, word, and byte counts for each file

Syntax

1
wc [OPTION] [FILE]...

Description

Print newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified. With no FILE, or when FILE is -, read standard input.

Option

Option Description
-c print byte counts
-l print line counts
-m print character counts
-w print word counts

Examples

count bytes in a file

1
wc -c file1

count words in a file

1
wc -w file1

count lines in a file

1
wc -l file1

count characters in a file

1
wc -m file1

Reference