head命令

head命令

output the first part of files输出文件前几行,默认是前10行

使用权限

所有使用者

语法格式

head [OPTION]... [FILE]...

常用选项

-n+数字 显示文件前n行

[root@www1 ~]# seq 1 10 >>test666.txt
[root@www1 ~]# cat test666.txt
aaa 111 222
ccc 333 444
aaa 111 222
ggg 555 666
bbb 777 888
eee 999 000
eee 999 000
1
2
3
4
5
6
7
8
9
10
[root@www1 ~]# head test666.txt
aaa 111 222
ccc 333 444
aaa 111 222
ggg 555 666
bbb 777 888
eee 999 000
eee 999 000
1
[root@www1 ~]# head -n 1 test666.txt
aaa 111 222
[root@www1 ~]# head -2 test666.txt
aaa 111 222
ccc 333 444
[root@www1 ~]#



猜你喜欢

转载自blog.51cto.com/12107790/2137237