Linux常用基本命令(head)

时间:2023-03-09 17:55:26
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 - ghostwu.txt
this is ghostwu ghostwu@dev:~/linux/more$ cat ghostwu.txt | head -
this is ghostwu how are you
ghostwu@dev:~/linux/more$ head -c ghostwu.txt
this is ghghostwu@dev:~/linux/more$ cat -n ghostwu.txt | head
this is ghostwu how are you file thank you
file thank you
file thank you
file thank you
ghostwu@dev:~/linux/more$