View a text file at the command line

To view the first lines of a text file, use the head command.

head file.txt = show first 10 lines of file
head -25 file.txt = show first 25 lines of file

To view the last lines of a text file, use the tail command.

tail file.txt = show last 10 lines of file
tail -25 file.txt = show last 25 lines of file

Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.