Online Linux Terminal Logo
OnlineLinuxTerminal
TextverarbeitungCLI Manual

$head

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

BefehlssyntaxPOSIX Standard
head [OPTIONS] [FILE...]
Linux-Community2.4k Online

Tausche dich mit Linux-Nutzern aus, lerne Befehle und lade PDF-Cheatsheets herunter.

Live im interaktiven Terminal ausprobieren

Client-seitige Simulation ohne Installation mit sofortigem Feedback.

Im Vollbild-Terminal öffnen ↗
bash — terminal

Überblick & Funktionsweise

`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.

Wichtige Optionen und Flags

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.

Praktische Anwendungsbeispiele

#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.