(5)实例
实例1:显示单个文件的头部内容—head文件
[root@moban ~]#head /etc/inittab
# inittab is onlyused by upstart for the default runlevel.
#
# ADDING OTHERCONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Systeminitialization is started by /etc/init/rcS.conf
#
# Individual runlevelsare started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete ishandled by /etc/init/control-alt-delete.conf
#实例2:显示多个文件的头部内容—head 文件 文件
[root@moban ~]# head /etc/inittab /etc/fstab
==> /etc/inittab <==
# inittab is only used by upstart for the defaultrunlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ONYOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by/etc/init/control-alt-delete.conf
#
==> /etc/fstab <==
#
# /etc/fstab
# Created by anaconda on Mon May 11 22:18:51 2015
#
# Accessible filesystems, by reference, are maintainedunder '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8)for more info
#
UUID=17ec9366-d335-4b07-8890-3765cabe746a / ext4 defaults 1 1
UUID=1f8e61c7-de21-42e3-89c5-cb28f607d1db /boot ext4 defaults 1 2 实例3:显示文件头部指定行数的内容—head –n <行数>
[root@moban ~]# head -n 5 /etc/inittab
# inittab is onlyused by upstart for the default runlevel.
#
# ADDING OTHERCONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Systeminitialization is started by /etc/init/rcS.conf
实例4:显示文件头部指定字符数的内容—head –c <字符数>
[root@moban ~]# head -c 88 /etc/inittab
# inittab is onlyused by upstart for the default runlevel.
#
# ADDING OTHERCONFIGURATI[root@moban ~]#