commandline session
head is a program on Unix and Unix-like operating systems used to display the beginning of a text file or piped data.
$sudo head /var/log/syslog Jan 5 20:10:05 debian syslogd 1.5.0#6.1: restart. Jan 5 20:10:05 debian anacron[1056]: Job `cron.daily' terminated Jan 5 20:10:05 debian anacron[1056]: Normal exit (1 job run) Jan 5 20:12:14 debian acpid: client connected from 1055[0:0] Jan 5 20:12:14 debian acpid: 1 client rule loaded Jan 5 20:12:14 debian acpid: client connected from 1055[0:0] Jan 5 20:12:14 debian acpid: 1 client rule loaded Jan 5 20:13:03 debian acpid: client 1055[0:0] has disconnected Jan 5 20:13:03 debian acpid: client 1055[0:0] has disconnected Jan 5 20:14:54 debian /usr/sbin/gpm[1239]: *** info [daemon/processrequest.c(42)]: $sudo head -n 5 /var/log/syslog Jan 5 20:10:05 debian syslogd 1.5.0#6.1: restart. Jan 5 20:10:05 debian anacron[1056]: Job `cron.daily' terminated Jan 5 20:10:05 debian anacron[1056]: Normal exit (1 job run) Jan 5 20:12:14 debian acpid: client connected from 1055[0:0] Jan 5 20:12:14 debian acpid: 1 client rule loaded $sudo head -n 0 /var/log/syslog $sudo head -n 1 /var/log/syslog Jan 5 20:10:05 debian syslogd 1.5.0#6.1: restart. $
Print the first 10 lines of each FILE to standard output.
Part of debian coreutils.
-n, --lines=[-]NUM print the first NUM lines instead of the first 10; with the leading '-', print all but the last NUM lines of each file
-c, --bytes=[-]NUM
print the first NUM bytes of each file; with the leading '-', print
all but the last NUM bytes of each file
$head /etc/default/grub
# If you change this file or any /etc/default/grub.d/*.cfg file,
# run 'update-grub' afterwards to update /boot/grub/grub.cfg.
# For full documentation of the options in these files, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`( . /etc/os-release && echo ${NAME} )`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=HDMI-1:1920x1080@84"
GRUB_CMDLINE_LINUX=""
$head -c 10 /etc/default/grub
# If you c$
-v, --verbose
always print headers giving file names
$head -v /etc/default/grub
==> /etc/default/grub <==
# If you change this file or any /etc/default/grub.d/*.cfg file,
# run 'update-grub' afterwards to update /boot/grub/grub.cfg.
# For full documentation of the options in these files, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`( . /etc/os-release && echo ${NAME} )`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=HDMI-1:1920x1080@84"
GRUB_CMDLINE_LINUX=""
$
-z, --zero-terminated line delimiter is NUL, not newline