Peek at the end of a file
See the latest with tail
⏱ Est. ~4 min
01 · Read
head shows the top, tail shows the bottom. Especially useful for log files, since the newest events are at the end.
💡 Picture thisLike flipping to the last page of a notebook to see what you wrote most recently.
Key points
- tail shows the last 10 lines by default
- tail -n 5 shows the last 5 lines
- Perfect for log files and recent changes
02 · Terminal exercise
head shows the start, but when a server has a problem, the newest events are at the tail. tail shows the last 10 lines — the freshest data.
(This section is interactive — please enable JavaScript.)
03 · Terminal exercise
Just like head, you can use -n to control how many lines tail shows.
(This section is interactive — please enable JavaScript.)
04 · Terminal exercise
tail works on data files too. Let's grab the last record from a CSV.
(This section is interactive — please enable JavaScript.)
05 · Quiz
Which command shows the last few lines of a file?
Other lessons in this chapter
⚠ The full interactive experience needs JavaScript. Please enable it and reload.
※ This is an independent Traditional Chinese teaching project — not an official Anthropic product. Claude™ is a trademark of Anthropic, PBC.