
{"id":18553,"date":"2009-12-23T12:07:32","date_gmt":"2009-12-23T06:37:32","guid":{"rendered":"http:\/\/froisa.com\/?p=152"},"modified":"2009-12-23T12:07:32","modified_gmt":"2009-12-23T06:37:32","slug":"head-2","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2009\/12\/23\/head-2\/","title":{"rendered":"Understanding the Unix &#8216;head&#8217; Command"},"content":{"rendered":"<h4><u>commandline session<\/u><\/h4>\n<p style=\"font-size: 120%\">head is a program on Unix and Unix-like operating systems used to display the beginning of a text file or piped data.<\/p>\n<pre>$sudo head \/var\/log\/syslog\nJan  5 20:10:05 debian syslogd 1.5.0#6.1: restart.\nJan  5 20:10:05 debian anacron[1056]: Job `cron.daily' terminated\nJan  5 20:10:05 debian anacron[1056]: Normal exit (1 job run)\nJan  5 20:12:14 debian acpid: client connected from 1055[0:0]\nJan  5 20:12:14 debian acpid: 1 client rule loaded\nJan  5 20:12:14 debian acpid: client connected from 1055[0:0]\nJan  5 20:12:14 debian acpid: 1 client rule loaded\nJan  5 20:13:03 debian acpid: client 1055[0:0] has disconnected\nJan  5 20:13:03 debian acpid: client 1055[0:0] has disconnected\nJan  5 20:14:54 debian \/usr\/sbin\/gpm[1239]: *** info [daemon\/processrequest.c(42)]:\n$sudo head -n 5 \/var\/log\/syslog\nJan  5 20:10:05 debian syslogd 1.5.0#6.1: restart.\nJan  5 20:10:05 debian anacron[1056]: Job `cron.daily' terminated\nJan  5 20:10:05 debian anacron[1056]: Normal exit (1 job run)\nJan  5 20:12:14 debian acpid: client connected from 1055[0:0]\nJan  5 20:12:14 debian acpid: 1 client rule loaded\n$sudo head -n 0  \/var\/log\/syslog\n$sudo head -n 1  \/var\/log\/syslog\nJan  5 20:10:05 debian syslogd 1.5.0#6.1: restart.\n$\n\n<\/pre>\n<p>Print the first 10 lines of each FILE to standard output.<br \/>\nPart of debian coreutils.<\/p>\n<pre>\n -n, --lines=[-]NUM\n print the first NUM lines instead of the first 10; with the leading\n '-', print all but the last NUM lines of each file\n<\/pre>\n<pre>\n-c, --bytes=[-]NUM\n print the first NUM bytes of each file; with the leading '-', print \nall but the last NUM bytes of each file\n$head  \/etc\/default\/grub\n# If you change this file or any \/etc\/default\/grub.d\/*.cfg file,\n# run 'update-grub' afterwards to update \/boot\/grub\/grub.cfg.\n# For full documentation of the options in these files, see:\n#   info -f grub -n 'Simple configuration'\n\nGRUB_DEFAULT=0\nGRUB_TIMEOUT=5\nGRUB_DISTRIBUTOR=`( . \/etc\/os-release &amp;&amp; echo ${NAME} )`\nGRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash video=HDMI-1:1920x1080@84\"\nGRUB_CMDLINE_LINUX=\"\"\n$head  -c 10 \/etc\/default\/grub\n# If you c$\n\n\n-v, --verbose\nalways print headers giving file names\n\n$head  -v \/etc\/default\/grub\n==&gt; \/etc\/default\/grub &lt;==\n# If you change this file or any \/etc\/default\/grub.d\/*.cfg file,\n# run 'update-grub' afterwards to update \/boot\/grub\/grub.cfg.\n# For full documentation of the options in these files, see:\n#   info -f grub -n 'Simple configuration'\n\nGRUB_DEFAULT=0\nGRUB_TIMEOUT=5\nGRUB_DISTRIBUTOR=`( . \/etc\/os-release &amp;&amp; echo ${NAME} )`\nGRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash video=HDMI-1:1920x1080@84\"\nGRUB_CMDLINE_LINUX=\"\"\n$\n\n\n<\/pre>\n<pre>-z, --zero-terminated\n line delimiter is NUL, not newline\n<\/pre>\n<p><a href=\"https:\/\/www.ibm.com\/docs\/en\/engineering-lifecycle-management-suite\/workflow-management\/7.2.0?topic=overview-file-content-types-line-delimiters\">The -z option explained<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217; terminated Jan 5 20:10:05 debian anacron[1056]: Normal exit (1 job run) Jan 5 20:12:14 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2009\/12\/23\/head-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Understanding the Unix &#8216;head&#8217; Command&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":[],"categories":[83],"tags":[],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/18553"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=18553"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/18553\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=18553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=18553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=18553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}