O'Reilly logo

SAMS Teach Yourself Unix in 10 Minutes by Robert Shimonski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The head Command

In some instances you may need to see the top of a file just like you may have needed to see the bottom of a file. To use the head command, do the same as you would with the tail command.

>head hosts.allow

Or

>head –20 hosts.allow

The output of this command starts from the top down (not the bottom up) and displays (by default) 10 lines from the top down instead of the bottom up.

Heads or Tails? Let's Flip for It! A good tip to remember when using head and tail is that when you are changing the default number of lines shown from 10, specify the amount of lines you do want to see. This can be done with the -# option that we just ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required