Linux常用基本命令(head)

head命令

作用:显示文件的头部内容,默认显示前面10行

格式:

head [option] [file]

-n <行数>

-c <字节>

ghostwu@dev:~/linux/more$ head ghostwu.txt 
this is ghostwu


how are you


file thank you
file thank you
file thank you
file thank you
ghostwu@dev:~/linux/more$ head -2 ghostwu.txt 
this is ghostwu

ghostwu@dev:~/linux/more$ cat ghostwu.txt | head -4
this is ghostwu


how are you
ghostwu@dev:~/linux/more$ head -c 10 ghostwu.txt 
this is ghghostwu@dev:~/linux/more$ cat -n ghostwu.txt | head
     1    this is ghostwu
     2    
     3    
     4    how are you
     5    
     6    
     7    file thank you
     8    file thank you
     9    file thank you
    10    file thank you
ghostwu@dev:~/linux/more$ 
原文地址:https://www.cnblogs.com/ghostwu/p/9054250.html