How many lines is this?
If you want to know how many lines a certain command outputs or how many lines are in a file, you can use the wc command to get this information and more.
How many lines in a file
To determine how many lines are in a file:
wc -l <file>
How many lines of output
To check how many lines a certain command is outputting:
<command> | wc -l
Getting other info
You can also retrieve the character count, byte count, and word count by replacing -l with -m, -c, and -w respectively. Examples:
wc -w myreport.txtecho "How many characters are in this sentence?" | wc -m
The first line will output how many words are in the file myreport.txt and the second line will output the character count that echo will output.




commands

Comments
There are no comments yet.