Online Linux Terminal Logo
OnlineLinuxTerminal
Traitement de texteCLI Manual

$head

Output the first part (top lines) of text files.

Syntaxe de la commandePOSIX Standard
head [OPTIONS] [FILE...]
Communauté Linux2.4k En ligne

Échangez avec des utilisateurs Linux, apprenez des commandes et téléchargez des PDF.

Essayer en direct dans le bac à sable interactif

Simulation côté client sans installation avec retour instantané.

Ouvrir dans le terminal plein écran ↗
bash — terminal

Aperçu et fonctionnement

`head` outputs the beginning portion of files, displaying the first 10 lines by default. It is ideal for quickly inspecting file headers, CSV schemas, or top log entries without loading massive files into memory.

Options et drapeaux courants

Flag / OptionDescription
-n [NUM]Print the first NUM lines instead of the default 10.
-c [NUM]Print the first NUM bytes of each file.
-qQuiet mode; never print headers giving file names.

Exemples pratiques du monde réel

#1View top 5 lines of syslog
head -n 5 /var/log/syslog

Extracts and prints only the first 5 lines of the system log file.