-c 統計字節數。
-l 統計行數。
-m 統計字符數。這個標誌不能與 -c 標誌一起使用。
-w 統計字數。一個字被定義為由空白、跳格或換行字符分隔的字符串。
-L 列印最長行的長度。
-help 顯示幫助信息
--version 顯示版本信息
實例1查看文件的字節數、字數、行數[root@localhost test]# cat test.txt
hnlinux
peida.cnblogs.com
ubuntu
ubuntu linux
redhat
Redhat
linuxmint
[root@localhost test]# wc test.txt
7 8 70 test.txt
[root@localhost test]# wc -l test.txt
7 test.txt
[root@localhost test]# wc -c test.txt
70 test.txt
[root@localhost test]# wc -w test.txt
8 test.txt
[root@localhost test]# wc -m test.txt
70 test.txt
[root@localhost test]# wc -L test.txt
17 test.txt
7 8 70 test.txt
行數 單詞數 字節數 文件名
實例2用wc命令怎麼做到只列印統計數字不列印文件名[root@localhost test]# wc -l test.txt
7 test.txt
[root@localhost test]# cat test.txt |wc -l
7
實例3用來統計當前目錄下的文件數[root@localhost test]# cd test6
[root@localhost test6]# ll
總計 604
---xr--r-- 1 root mail 302108 11-30 08:39 linklog.log
---xr--r-- 1 mail users 302108 11-30 08:39 log2012.log
-rw-r--r-- 1 mail users 61 11-30 08:39 log2013.log
-rw-r--r-- 1 root mail 0 11-30 08:39 log2014.log
-rw-r--r-- 1 root mail 0 11-30 08:39 log2015.log
-rw-r--r-- 1 root mail 0 11-30 08:39 log2016.log
-rw-r--r-- 1 root mail 0 11-30 08:39 log2017.log
[root@localhost test6]# ls -l | wc -l
8
數量中包含當前目錄
(參考:http://www.cnblogs.com/peida/archive/2012/12/18/2822758.html)
公益傳播測試知識、技能與正能量!感謝作者!
分享測試生活,思考測試人生!歡迎投稿!
文章圖片來自網絡,如有侵權請見諒,請聯繫我們妥善處理。
735821166@qq.com
網址:www.gloryroad.cn
微信公眾號:gloryroadtrain
性能測試QQ群:415987441
測試招聘QQ群: 203715128
自動化3群QQ: 371211499
Python群:457561756