head

head

This command will display the beginning of a file. The default is 10 lines. Example: head -n50 /var/log/messages This will show the first 50 lines of /var/log/messages Here is the output of the example:

head -n50 /var/log/messages Aug 30 06:16:07 localhost syslogd 1.4.1#16ubuntu6: restart. Aug 30 06:21:03 localhost kernel: Inbound IN=eth0 OUT= MAC=00:d0:59:9c:3d:fc:00:0e:0c:2e:db:32:08:00 src=192.168.2.63 DST=192.168.2.99 LEN=198 TOS=0x00 PREC=0x00 TTL=64 ID=2462 DF PROTO=UDP SPT=138 DPT=138 LEN=178 Aug 30 06:27:03 localhost kernel: Inbound IN=eth0 OUT= MAC=00:d0:59:9c:3d:fc:00:0e:0c:2e:db:32:08:00 src=192.168.2.63 DST=192.168.2.99 LEN=198 TOS=0x00 PREC=0x00 TTL=64 ID=2473 DF PROTO=UDP SPT=138 DPT=138 LEN=178 Aug 30 06:34:03 localhost kernel: Inbound IN=eth0 OUT= MAC=00:d0:59:9c:3d:fc:00:0e:0c:2e:db:32:08:00 src=192.168.2.63 DST=192.168.2.99 LEN=198 TOS=0x00 PREC=0x00 TTL=64 ID=2484 DF PROTO=UDP SPT=138 DPT=138 LEN=178 Aug 30 06:40:53 localhost kernel: e100: eth0: e100_watchdog: link down Aug 30 06:52:01 localhost kernel: e100: eth0: e100_watchdog: link up, 10Mbps, half-duplex Aug 30 07:01:22 localhost kernel: Inbound IN=eth0 OUT= MAC=00:d0:59:9c:3d:fc:00:0e:0c:2e:db:32:08:00 src=192.168.5.63 DST=192.168.5.99 LEN=198 TOS=0x00 PREC=0x00 TTL=64 ID=2504 DF PROTO=UDP SPT=138 DPT=138 LEN=178 Aug 30 07:12:22 localhost kernel: Inbound IN=eth0 OUT= MAC=00:d0:59:9c:3d:fc:00:0e:0c:2e:db:32:08:00 src=192.168.5.63 DST=192.168.5.99 LEN=198 TOS=0x00 PREC=0x00 TTL=64 ID=2517 DF PROTO=UDP SPT=138 DPT=138 LEN=178 Aug 30 07:24:22 localhost kernel: Inbound IN=eth0 OUT= MAC=00:d0:59:9c:3d:fc:00:0e:0c:2e:db:32:08:00 src=192.168.5.63 DST=192.168.5.99 LEN=198 TOS=0x00 PREC=0x00 TTL=64 ID=2530 DF PROTO=UDP SPT=138 DPT=138 LEN=178 Aug 30 07:35:17 localhost gconfd (mike-7650): Exiting Aug 30 07:35:18 localhost shutdown[5892]: shutting down for system halt Aug 30 07:35:25 localhost kernel: apm: BIOS version 1.2 Flags 0x03 (Driver version 1.16ac) Aug 30 07:35:25 localhost kernel: apm: disabled on user request. Aug 30 07:35:29 localhost kernel: Kernel logging (proc) stopped. Aug 30 07:35:29 localhost kernel: Kernel log daemon terminating. ---cut--- Options -c num first num of bytes -c numk first num kilobytes of file -c numm first num of megabytes of file -n num number of lines