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:

  • Linux Booting Process - 6 Steps Linux Booting Process - 6 Steps 1. BIOS §  BIOS stands for Basic Input/Output System §  Performs some system integrity checks (POST-Power On Self Test) §  Searches, loads, and executes … Read More
  • Introduction & Basic Concepts of Linux What is Linux ? Linux open source operating system, or Linux OS, developed by Linus Torvalds is a freely distributable, cross platform operating system based  on UNIX that can be installed on PCs, la… Read More
  • Group Management in Linux Group Management :   A user can be participated to more than one group at the same time. A user who is member of a group can change to that group without password but a user NOT member can … Read More
  • User Management in Linux This article will try to cover basics of Linux user management through command line tools. Linux provides 5 different alternatives to choose the accessibility. They are as listed below. Super User or … Read More
  • Common Myths Busted - For Anti-Linux Users (Must Read) Introduction When it comes to operating systems people have always hailed Windows and Mac OS X as the two front-runners of the OS battle. However, due to recent efforts of the ever-growing Linux community, this scenario h… Read More

0 comments:

Post a Comment