The WC command is used to count the number of rows, words, and letters of the file's contents.
However, if you want to count the number of rows for all the files in a directory, the WC does not provide recursive statistics.
However, you can combine the Find command, for example:
$ Wc-l ' Find-name *.c '
Where the-L parameter is the count of rows, andfind-name *.c is to find all C files under the current directory (including subdirectories)," is the replacement command in the shell."
Of course, there are many ways to achieve this, and I just think it's easier to remember.
The test results are as follows:
Finally, attach a WC to the use of help (man WC)
NAME
Wc-print newline, Word, and byte counts for each file
Synopsis
WC [OPTION] ... [FILE] ...
WC [OPTION] ...--files0-from=f
DESCRIPTION
Print newline, Word, and byte counts for each file, and a all line if more than one file is specified. With no file, or if file is-, read standard input. A word is a non-zero-length sequence
of characters delimited by white space. The options below is used to select which counts is printed, always in the following order:newline, Word, character, BYTE, maximum line length.
-C,--bytes
Print the byte counts
-M,--chars
Print the character counts
-L,--lines
Print the newline counts
--files0-from=f
Read input from the files specified by nul-terminated names in file F; If F Is-then read names from standard input
-L,--max-line-length
Print the length of the longest line
-W,--words
Print the word counts
--help Display this Help and exit
--version
Output version information and exit
Number of lines of code for all files under the WC Statistics folder under Linux (including subdirectories)