Why would we redirect standard input to the wordcount command?


I’m having trouble grasping the concept of redirecting to commands, like the wordcount command.

In ‘Learn the Command Line’/Ecosystem project step 4 tells me to: " Redirect plants.txt as standard input to the wordcount command. Use the -l option on the wordcount command. "

I used help to see the command is ‘wc -l <plants.txt’ but my question is WHY?? What does this do?



Please post a link to the exercise. Thanks.


Whoops, sorry. Edited to add link.


wc is a command, and I’m guessing the -l switch is for line count, not word count. Including blank lines, there are five in all.

Without the -l option, we get,

 5  77 503

which one may deduce to be line count, word count, character count, all combined.