欢迎访问linux宝典,请记住本站唯一域名:www.linuxbaodian.com

head命令

来源:原创    更新时间:2018-08-26 00:23:21    作者:管理员    浏览:2497
  • 命令描述
head命令用于显示文件的开头的内容。在默认情况下,head命令显示文件的头10行内容。
  • 命令语法
head [选项] [参数]
  • 命令选项
-n<数字>:指定显示头部内容的行数;
-c<字符数>:指定显示头部内容的字符数;
-v:总是显示文件名的头信息;
-q:不显示文件名的头信息。
  • 命令参数
文件名 可以是文件列表
  • 命令实例

实例1:默认显示文件前10行

[root@linuxbaodian files]# head 01.txt 
She had been shopping with her Mom in Wal-Mart. 
She must have been 6 years old, this beautiful brown haired, freckle-faced image of innocence. 
What? Mom asked.
Let's run through the rain! She repeated.
No, honey. We'll wait until it slows down a bit. Mom replied.
Don't you remember? When you were talking to Daddy about his cancer, you said, If God can get us through this, he can get us through anything!

This young child waited about another minute and repeated: "Mom, let's run through the rain."

We'll get soaked if we do. Mom said.

实例2:从文件头部显示前XX个字符

[root@linuxbaodian files]# head -c 20 01.txt 
She had been shoppin
[root@linuxbaodian files]# head -c 100 01.txt 
She had been shopping with her Mom in Wal-Mart. 
She must have been 6 years old, this beautiful brow

上一条命令:tail

下一条命令:more

笔记分享

表情

共0条分享记录
  • 这篇文章还没有收到评论,赶紧来抢沙发吧~

相关内容

最受欢迎

猜你喜欢

最受争议