Results 1 to 5 of 5

Thread: tail and head command...

  1. #1
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    tail and head command...

    what is the difference between tail and head command? I know the following difference, "tail shows last lines (the tail) of the given file, head shows you the first lines (the head) of the given file".

    I want to know whether anyother difference are there or not?

    -----------------
    suresh


  2. #2
    Contributing Member
    Join Date
    Apr 2007
    Answers
    58

    Re: tail and head command...

    Thats the difference and you can also use different options with each of the commands. Type man tail/head at command prompt for more!!!!

    Regards,
    Anoop :)
    If its useful, dont forget to [COLOR="Red"]THANK[/COLOR] me :cool:

  3. #3
    Junior Member
    Join Date
    Aug 2007
    Answers
    15

    Re: tail and head command...

    I am not so sure if you know this or not, but just in case you don't know there is a small difference in the option part of these commands i.e.

    head -n filename: Displays first 'n' lines from the specified file
    tail -n filename: Displays last 'n' lines from the specified file
    tail +n filename: Displays lines starting from number 'n' to the last line from the specified file.

    But no such difference is there if you use '+' option with the head command.

    Of course you can use man command to find out more.

    Thanks and Regards
    Ashis


  4. #4
    Contributing Member
    Join Date
    Oct 2007
    Answers
    88

    Smile Re: tail and head command...

    Quote Originally Posted by psuresh1982 View Post
    what is the difference between tail and head command? I know the following difference, "tail shows last lines (the tail) of the given file, head shows you the first lines (the head) of the given file".

    I want to know whether anyother difference are there or not?

    -----------------
    suresh
    head is used for open the specified file
    but tail is not user for open the file
    ex:
    head file1 file2 file3


  5. #5
    Junior Member
    Join Date
    Aug 2007
    Answers
    15

    Re: tail and head command...

    Quote Originally Posted by sarathi trichy View Post
    head is used for open the specified file
    but tail is not user for open the file
    ex:
    head file1 file2 file3
    You can use both head as well as tail command to open a file. The point to notice is that in both the cases a default value of 10 is taken i.e.
    head filename: Will display first 10 lines from the file, and
    tail filename: Will display last 10 lines from the file.

    Cheers
    Ashis


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact