Just the beginning, just the end

Long files don't fit on one screen. You rarely need all of them anyway:

  • head FILE shows the first 10 lines, and head -n 3 FILE shows the first 3.
  • tail FILE shows the last 10, and tail -n 2 FILE shows the last 2.
head -n 3 ballad.txt
tail -n 2 ballad.txt

Real world: a log file grows at the bottom, so tail is where the news is. On a real system, tail -f app.log follows the file and prints new lines the moment they're written. That's how people watch a server live.