Display the first part of a file with head

by
on
October 14, 2008

Similar to the tail command which shows you the last few lines of a text file, the head command lets you to quickly view the first few lines.

The head command syntax.

head [options] file

By default head will show you the first 10 lines of a text file.

$ head textfile.txt

You can change the number of lines displayed by adding ‘-n‘ option and adding the number of lines.

$ head -n 3 textfile.txt

This will show the first 3 lines in the file.

No Comments
commands
, ,

Related posts:

  1. Display the last part of a file with tail
  2. Determine file type with the file command
  3. Delete a specific line from a text file with sed
  4. Remove Windows carriage returns with tr
  5. Essential Linux Commands

Comments (0)

No comments yet

Trackbacks (0)

No trackbacks yet

Leave a Comment

(displayed with your post)
(will not be published)
(optional)

Copyright 2008-2010 WiredRevolution.com. All rights reserved.