Skip to content
zero2vibecodelearn vibe coding

What head -n does

head -n 5 log.txt: Show the first 5 lines of a file.

The head command page covers what it does in general, with an example.

head-n5log.txt
  • head— command — first lines of a file
  • -n— flag — how many lines
  • 5— how many lines
  • log.txt— argument: a file, a folder, or text

What it does when you run it

$ head -n 5 log.txt
ok start
error: disk full
ok done
error: retry
ok finished

Run it yourself

The same files. Nothing here can break, and nothing leaves your browser.

Explain other commands

Written by Mikhail Kuzmitskii