Sunday, April 27, 2014

head

  •   head command example

Output the first part of files, prints the first part (10 lines by default) of each file.

SYNTAX
      head [options]... [file]...


Examples

Extract the first 85 lines from a file:


$ head -5 file.txt

this is test1.
this is test2.
this is test3.
this is test4.
this is test5.


Extract lines 40-50 from a file, first using head to get the first 50 lines then tail to get the last 10:

$ head -50 file.txt | tail -10





Related Posts:

  • Chage Command with example to manage Linux password expiration v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} chage - change user password expiry information  chage ch… Read More
  • A-Z Index of the Mostly used Bash command line for Linux A      awk B      bzip2 C      cd       |     crontab  … Read More
  • df df command examples Displays the file system disk space usage. By default df -k displays output in bytes. $ df -k Filesystem           1K-blocks  &n… Read More
  • File and Directory Permissions Permissions is a type of good security features in Linux operating system. Permissions is used to assign on files as well as on directories. There are three types of files permissions: Read (r) - To view a file's … Read More
  • date date command examples Set the system date: $ date -s "01/31/2010 23:59:53" Once you’ve changed the system date, you should syncronize the hardware clock with the system date as shown below. $ hwcloc… Read More

0 comments:

Post a Comment