Linux wc command

Linux wc command

 Linux wc command


The Linux wc command is used to count the number of lines, words, and byte (character) in a file or input stream.

Syntax:

wc [OPITON] [FILE}

Example:

Use -l to count the number of lines in a file

wc -l myfile.txt

Use -w to count the number of words in a file

wc -w myfile.txt

Use -c to count the number of bytes in a file. You can use this to count characters in a file

wc -c myfile.txt

Use wc with Piped Input

You can also use wc with piped input in Linux and count the lines, words, and characters in input data.

cat myfile.txt | wc -lwc

Another example of wc command is to count the number of lines in the output of the previous command.

find . -name "*.log" | wc -l
Souy Soeng

Souy Soeng

Our website teaches and reads PHP, Framework Laravel, and how to download Admin template sample source code free. Thank you for being so supportive!

Github

Post a Comment

CAN FEEDBACK
close