headIT technician command center
Linux · Linux and Bash

head

Display the first lines of a file.

Copy-ready commandhead
head -n 20 /var/log/syslog

Requirements and permissions

Requirements
Linux with the referenced utility installed
Permissions
Use sudo or root only when required
Last reviewed
2026-07-31

Examples

Basic example

Display the first lines of a file.

head -n 20 /var/log/syslog

Common errors

Command not found

Confirm Linux with the referenced utility installed is installed and available in your current shell.