Home » Questions » Computers [ Ask a new question ]

Terminal command for seeing the first xxx lines of a file

Terminal command for seeing the first xxx lines of a file

Can you guys help me? I can't remember the terminal command to open a large text file, but only display (for example) 20 lines at a time. The reason for this is I am trying to read a 1.3gb error log file. Can somebody help me with the right command?

Asked by: Guest | Views: 141
Total answers/comments: 3
Guest [Entry]

"Try man head

head -- display first lines of a file"
Guest [Entry]

"you can use head, less, more ,and awk

$ awk 'NR%20==0{print;getline <""-""}NR{print}' file

$ more -20 file

$ head -20 file # but only shows 20 lines and doesn't scroll."
Guest [Entry]

most is the result of 20 years of fundamental research about advanced terminal paging techniques.