Statistics The total number of files for the specified suffix command: find. -name *.cpp | Wc-l statistics The total number of lines of code in a directory and the number of individual file rows: Find. -name *.h | Xargs wc-llinux number of files in the statistics folder The first method: Ls-l|grep "^-" |wc-lls-l long list output The file information in this directory (note that the file here, different from the general file, may be directory, links, device files, etc.). If the Ls-lr|grep "^-" |wc-l can be counted together with the files in the subdirectory. grep ^-here will be a long list of output information filtering part, only keep the general file, if only the directory is ^DWC-L statistics output information of the number of rows, because it has been filtered to only the general file, so the statistical result is the general file information line number, and because a line of information corresponding to a file, So that is the number of files. The second method: Find./-type f|wc-l because the default find will go to the subdirectory lookup, if you only want to find the file of the current directory with the need to explain that the second method is much faster than the first method, especially when it is also statistical subdirectories.
Number of Linux statistics files or lines of code