Simple, extensible file previewers.
Examples
Beginning of a File - head
head big.txt
- first 10 lineshead -n 3 big.txt
- first 3 lineshead -n -5 big.txt
- up to the 5th-to-last line (exclusive)
End of a File - tail
tail big.txt
- last 10 linestail -n 3 big.txt
last 3 linestail -n +5 big.txt
starting at the 5th line (inclusive)
Following Output
tail
also comes with follow output feature. This can be useful when
watching logging/output files written to in real-time by other programs.
tail -f output.txt
last 10 lines and print new lines when they are writtentail -n +0 -f output.txt
all lines and print new lines when they are written
See Also
man head
man tail