@snuffles
2020-08-15T09:56:08.000000Z
字数 224
阅读 4114
linux
wc 命令用于统计文件内容的行数、单词数、字母数。但是如果想统计一个目录下所有文件的行数,wc 并没有提供递归统计。
不过,可以结合 find 命令,例如:
$ wc -l `find -name *.c`\\only c files
$ wc -l `find -name '*.*'`\\all the files
其中,-l 参数是统计行数,find -name *.c 是查找当前目录(包含子目录)下所有的C文件, 是 shell 中的替换命令。