11 · The Command Line

head / tail

First or last lines of a file

head shows the top lines of a file, tail the bottom. “tail -f” keeps following a file live as new lines are written.

Concrete example

“tail -f server.log” streams a running server's log so you watch errors appear in real time.

Why it matters

“tail -f” is how essentially everyone watches logs while debugging.