Friday, October 9, 2015

Display first/top few lines from file in unix/linux

head -lines filename

Example: $ head -3 file.txt

It will display first 3 lines form file.txt. Here lines is an optional parameter. If you don't specify lines it will display 10 lines by default.

Example: $ head file.txt

It will display first 10 lines from file.txt

No comments:

Post a Comment