Table of Contents

Linux Commands#File, Directory

head - How to use head Command in Linux

Help / Manual

# head --help
Usage: head [OPTION]... [FILE]...
Print the first 10 lines of each FILE to standard output.

  -c, --bytes=[-]K         print the first K bytes of each file;
  -n, --lines=[-]K         print the first K lines instead of the first 10;
# man head
NAME
       head - output the first part of files
SYNOPSIS
       head [OPTION]... [FILE]...

DESCRIPTION
       Print  the  first  10  lines of each FILE to standard output.  

       -c, --bytes=[-]K
              print the first K bytes of each file

       -n, --lines=[-]K
              print the first K lines instead of the first 10;

Example

# head -n 10 ifcfg* |more
==> ifcfg-bond0 <==
DEVICE=bond0
BOOTPROTO=static
ONBOOT=yes
IPADDR=172.xx.xx.xx
NETMASK=255.255.255.0
BONDING_OPTS="mode=1 miimon=100 updelay=500"

==> ifcfg-bond1 <==
DEVICE=bond1
BOOTPROTO=static
ONBOOT=yes
IPADDR=10.xx.xx.xx
NETMASK=255.255.255.0
BONDING_OPTS="mode=1 miimon=100 updelay=500"

==> ifcfg-eth0 <==
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
MASTER=bond0
SLAVE=yes
USERCTL=no

==> ifcfg-eth1 <==
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
MASTER=bond1
SLAVE=yes
USERCTL=no

==> ifcfg-eth2 <==
E=eth2
BOOTPROTO=none
ONBOOT=no
(abbr)