wc命令
wc用法:wc /etc/passwd
[root@localhost ~]# wc /etc/passwd 31 45 1420 /etc/passwd
31, 为行数 单独显示用 -l参数
45,为单词数 -w 参数
1420,为字节数 -c参数 -m(字符数)
/etc/passwd,为文件名称
可以统计出文件的行数,单词书,字节数,并显示。
[root@localhost ~]# wc -l /etc/passwd 31 /etc/passwd [root@localhost ~]# wc -w /etc/passwd 45 /etc/passwd [root@localhost ~]# wc -c /etc/passwd 1420 /etc/passwd [root@localhost ~]# wc -m /etc/passwd 1420 /etc/passwd
技巧:通常与管道命令结合,统计行数
who | wc -l
ls /tmp |wc- l 在目录下,查看目录内所有行。
浙公网安备 33010602011771号