head命令以行为单位,取文件的内容,后面不接参数时默认打印前10行。
语法格式:head [参数] [文件]
常用参数:
参考实例
显示前3行文件内容:
[root@linuxcool ~]# head -n 3 install.log Installing libgcc-4.4.7-23.el6.x86_64 warning: libgcc-4.4.7-23.el6.x86_64: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Installing setup-2.8.14-23.el6.noarch
显示文件名信息,并显示文件前两行:
[root@linuxcool ~]# head -v -n 2 test.txt ==> test.txt <== hello world hello linuxcool
显示文件前5个字符:
[root@linuxcool ~]# head -c 5 test.txt hello
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)