What does head do?
head shows the first lines of a file — 10 by default, or any number with -n.
head [-n N] file
Most useful options
| Option | What it does |
|---|---|
| -n N | show the first N lines |
| -c N | show the first N bytes |
head examples
In security work
head -c 16 file | xxd shows a file's "magic bytes", revealing its real type whatever its extension.
Questions about head
How do I show the first 20 lines?
head -n 20 file