October 2018
Beginner
794 pages
19h 23m
English
How many lines of source code are there in the C netcat.c source file I downloaded? (Here, we use a small part of the popular open source netcat utility code base.) We use the wc utility. Before we go further, what's wc? word count (wc) is a filter: it reads input from stdin, counts the number of lines, words, and characters in the input stream, and writes this result to its stdout. Further, as a convenience, one can pass filenames as parameters to it; passing the -l option switch has wc only print the number of lines:
$ wc -l src/netcat.c618 src/netcat.c$
Here, the input is a filename passed as a parameter to wc.
Interestingly, we should by now realize that if we do not pass it any parameters, wc would read its input from stdin, ...
Read now
Unlock full access