First page Back Continue Last page Image

The head and tail Commands

There are also 2 commands that are designed to specifically show the start or end of the target file, which can be useful when programming

head

tail

Command filename

head tic-tac-toe.py

tail tic-tac-toe.py

Default 10 lines

First 10 lines

Last 10 lines

-n number of lines

head -n 5 tic-tac-toe.py

tail -n 15 tic-tac-toe.py

-c number of bytes

yes

yes

-q combine files

yes

yes

-f follow file growth

No

Yes – Used to monitor log files

-v verbose

yes

yes

Feature

cat Alternatives