Online Linux Terminal Logo
OnlineLinuxTerminal
Обработка текстаCLI Manual

$head

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

Синтаксис командыPOSIX Standard
head [OPTIONS] [FILE...]
Сообщество Linux2.4k Онлайн

Общайтесь с пользователями Linux, учите команды и скачивайте шпаргалки.

Попробуйте в интерактивной песочнице

Клиентская симуляция без установки с мгновенным результатом.

Открыть в полноэкранном терминале ↗
bash — terminal

Обзор и принцип работы

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

Основные флаги и параметры команды

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.

Практические примеры использования

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