- 工信部備案號 滇ICP備05000110號-1
- 滇公安備案 滇53010302000111
- 增值電信業(yè)務經營許可證 B1.B2-20181647、滇B1.B2-20190004
- 云南互聯(lián)網(wǎng)協(xié)會理事單位
- 安全聯(lián)盟認證網(wǎng)站身份V標記
- 域名注冊服務機構許可:滇D3-20230001
- 代理域名注冊服務機構:新網(wǎng)數(shù)碼
wc命令用來打印文件的文本行數(shù)、單詞數(shù)、字節(jié)數(shù)等(print the number of newlines, words, and bytes in files)。在Windows的Word中有個“字數(shù)統(tǒng)計”的工具,可以幫我們把選中范圍的字數(shù)、字符數(shù)統(tǒng)計出來。Linux下的wc命令可以實現(xiàn)這個 功能。使用vi打開文件的時候,底下的信息也會顯示行數(shù)和字節(jié)數(shù)。
(1)常用參數(shù)
格式:wc -l <file>
打印指定文件的文本行數(shù)。(l=小寫L)
以下參數(shù)可組合使用。
參數(shù):-c, --bytes
打印字節(jié)數(shù)(print the byte counts)
參數(shù):-m, --chars
打印字符數(shù)(print the character counts)
參數(shù):-l, --lines
打印行數(shù)(print the newline counts)
參數(shù):-L, --max-line-length
打印最長行的長度(print the length of the longest line)
參數(shù):-w, --words
打印單詞數(shù)(print the word counts)
(2)wc命令與 ls命令搭配使用
統(tǒng)計當前文件夾下文件的個數(shù)
ls -l |grep "^-"|wc -l
統(tǒng)計當前文件夾下目錄的個數(shù)
ls -l |grep "^d"|wc -l
統(tǒng)計當前文件夾下文件的個數(shù),包括子文件夾里的
ls -lR|grep "^-"|wc -l
統(tǒng)計文件夾下目錄的個數(shù),包括子文件夾里的
ls -lR|grep "^d"|wc -l
售前咨詢
售后咨詢
備案咨詢
二維碼
TOP