126 words
1 minutes
The Word Count Command
Just now, I wanted to see how many blogs I’ve written so far. So instead of manually counting them in the posts directory, I went to that directory and used the wc word count command after Googling it.

As you can see, I used the wc command and passed it the -l flag to count the number of lines. The output of ls is piped into wc -l, which then counts and displays the number of lines. Some other useful use-cases include:
Counting Words in stdout
If you want to count the number of words in the stdout, you can use wc with the -w.
your_command | wc -w
Counting Characters in stdout
If you need to count all characters, use wc with the -c option.
your_command | wc -c
The Word Count Command
https://rabisiddique.com/posts/the-wc-command/Author
Rabi Siddique
Published at
2024-07-18

