head

Output the first part of files. Useful for peeking at the structure of a file without opening the whole thing.

Synopsis

head [options] [file]

Core Options

-n num

Print the first num lines instead of the default 10.

-c num

Print the first num bytes.

Usage Examples

Default Usage

Show the first 10 lines of a file.

head data.csv

Show First N Lines

Show the first 5 lines (e.g., to see CSV headers and a few rows).

head -n 5 data.csv

Pipe with Other Commands

Show the first 10 results of a search.

grep 'error' log.txt | head
Built for builders.