ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 语法 ``` -c, --bytes print the byte counts -m, --chars print the character counts -l, --lines print the newline counts -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 ``` ## 实例 ``` >cat demo.txt ab bc cd de ef fg gh ``` ### 统计字符数 ``` > cat demo.txt | wc -c 22 ``` ### 统计单词数 ``` > cat demo.txt | wc -w 7 ``` ### 统计行数 ``` > cat demo.txt | wc -l 2 ``` ### 统计项目的行数 ``` > find ./ -type f |grep -v .git |xargs wc -l {} 239 ./SOURCES/im_common/stop 12 ./SOURCES/units/im_server.service 22 ./SOURCES/units/mongodb.service 49 ./SOURCES/units/mysql.service 49 ./SOURCES/units/mysqld.service 32 ./SOURCES/units/nginx.service 26 ./SOURCES/units/php-fpm.service 84 ./SOURCES/units/redis.service 61519 total ```