Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5606869
  • 博文数量: 922
  • 博客积分: 19333
  • 博客等级: 上将
  • 技术积分: 11226
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-27 14:33
文章分类

全部博文(922)

文章存档

2023年(1)

2020年(2)

2019年(1)

2017年(1)

2016年(3)

2015年(10)

2014年(17)

2013年(49)

2012年(291)

2011年(266)

2010年(95)

2009年(54)

2008年(132)

分类: LINUX

2011-07-04 21:20:39

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


[功能] 

打印文件的开头部分。 


[描述] 

默认head命令打印其相应文件的开头10行。 


[举例] 

*查看的测试文件内容: 

[root@lv-k samba]# cat smb.conf 

[global] 

workgroup = MY_GROUP 

server string = "MySamba" 

netbios name = "MySamba Server ip" 

hosts allow = 127. 192.168.12. 192.168.13. 10.1.2. 

security = share 


[public1] 

path = /home/mysamba 

public = yes 

writable = yes 


[public2] 

path = /root/mysamba 

public = yes 

writable = yes 

browseable = yes 

hosts allow = 10.1.2.213 10.1.2.217 


[public3] 

path = /tmp/mysamba 

public = yes 

writable = yes 

browseable = yes 

security = user 

valid users = quietheart lv-k 

create mask = 0700 

directory mask = 0700 


*打印文件的开始10行: 

[root@lv-k samba]# head smb.conf 

[global] 

workgroup = MY_GROUP 

server string = "MySamba" 

netbios name = "MySamba Server ip" 

hosts allow = 127. 192.168.12. 192.168.13. 10.1.2. 

security = share 


[public1] 

path = /home/mysamba 

public = yes 


*打印文件的开始12个字节: 

[root@lv-k samba]# head -c 12 smb.conf 

[global] 

wor 


*打印文件的除了最后12个字节以外的内容: 

[root@lv-k samba]# head -c -12 smb.conf 

[global] 

workgroup = MY_GROUP 

server string = "MySamba" 

netbios name = "MySamba Server ip" 

hosts allow = 127. 192.168.12. 192.168.13. 10.1.2. 

security = share 


[public1] 

path = /home/mysamba 

public = yes 

writable = yes 


[public2] 

path = /root/mysamba 

public = yes 

writable = yes 

browseable = yes 

hosts allow = 10.1.2.213 10.1.2.217 


[public3] 

path = /tmp/mysamba 

public = yes 

writable = yes 

browseable = yes 

security = user 

valid users = quietheart lv-k 

create mask = 0700 

directory 


*打印文件的头5行: 

[root@lv-k samba]# head -n 5 smb.conf 

[global] 

workgroup = MY_GROUP 

server string = "MySamba" 

netbios name = "MySamba Server ip" 

hosts allow = 127. 192.168.12. 192.168.13. 10.1.2. 


*打印除了最后20行的内容: 

[root@lv-k samba]# head -n -20 smb.conf 

[global] 

workgroup = MY_GROUP 

server string = "MySamba" 

netbios name = "MySamba Server ip" 

hosts allow = 127. 192.168.12. 192.168.13. 10.1.2. 

security = share 


[public1] 

这里,我们可以看出来,使用"-"前缀的数字表示指明不会显示相应大小的内容。 



[其它] 

更多的信息,可以参考"info head". 

阅读(4243) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

vaqeteart2020-02-21 21:16:27

to org