wc #统计 行数 字节数 列数 行的长度
选项:
-l #统计行数
-w #统计列数,默认以空白字符为分隔符
-c #统计字节数
-L #统计文件中最长的行的长度
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
[root@qls ~]# wc passwd 18 26 798 passwd [root@qls ~]# wc -l passwd 18 passwd [root@qls ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 [root@qls ~]# wc /etc/hosts 2 10 158 /etc/hosts [root@qls ~]# wc -w /etc/hosts 10 /etc/hosts [root@qls ~]# ll passwd -rw-r--r--. 1 root root 798 Jul 13 16:49 passwd [root@qls ~]# ll /etc/hosts -rw-r--r--. 1 root root 158 Jun 7 2013 /etc/hosts [root@qls ~]# wc -c /etc/hosts 158 /etc/hosts [root@qls ~]# wc -c passwd 798 passwd [root@qls ~]# [root@qls ~]# wc -L passwd 68 passwd [root@qls ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 [root@qls ~]# wc -L /etc/hosts 78 /etc/hosts [root@qls ~]# name=ewuighrtuighwiorteugh [root@qls ~]# echo $name ewuighrtuighwiorteugh [root@qls ~]# echo $name | wc -L 21 |