Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I view only the first n lines of the file?

Tags:

shell

csh

I tried head +10 and it didn't work.

like image 872
vehomzzz Avatar asked Sep 11 '09 14:09

vehomzzz


2 Answers

Did you try the man page for head?

head -n 10 filename
like image 178
kwatford Avatar answered Oct 27 '22 15:10

kwatford


Head is a fine tool, but you might also try:

sed 10q path

For code golf fanatics, sed is always better than head :)

like image 33
William Pursell Avatar answered Oct 27 '22 15:10

William Pursell