head (Unix)

head (Unix)

head (englisch „Kopf“) ist ein Programm für Unix und unixähnliche Betriebssysteme zur Ausgabe der ersten Zeilen einer Datei. Im Gegensatz zu einem Texteditor ist der Benutzer jedoch mit head nicht in der Lage Änderungen an der Datei vorzunehmen. Das Gegenstück zu head ist tail, welches die letzten Zeilen einer Datei anzeigt.

Inhaltsverzeichnis

Arbeitsweise

Die Syntax von head gleicht vielen anderen Kommandozeilen-Programmen:

head [Schalter] <Dateiname>

Normalerweise gibt head die ersten 10 Zeilen einer Datei aus. Mit den Schaltern kann Art (Zeilen, Bytes) und Anzahl der Ausgabe gewählt werden.

Typische Anwendungsbeispiele

Das folgende Beispiel gibt die ersten 20 Zeilen von <Dateiname> aus:

head -n 20 <Dateiname>

Gibt die ersten 15 Bytes aller Dateien aus die mit foo beginnen.

head -c 15 foo*

Exotische Beispiele

Viele frühere Unix-Versionen hatten das Kommando nicht, deshalb verwies die Dokumentation ud Bücher auf sed:

sed 5q foo

Manche Unix-Systeme benutzen noch die alte Syntax. Dort wird die Option -n nicht unterstützt. Hier muss folgende Syntax benutzt werden um die ersten 20 Zeilen, beziehungsweise die ersten 50 Bytes auszugeben.

head -20 <Dateiname>
head -50c <Dateiname>

Diese Syntax ist veraltet und entspricht nicht dem POSIX-Standard 1003.1-2001.

Weblinks


Wikimedia Foundation.

Игры ⚽ Поможем сделать НИР

Schlagen Sie auch in anderen Wörterbüchern nach:

  • Head (Unix) — head est une commande UNIX qui permet d afficher les premières lignes de texte d un fichier ou de l entrée standard. La syntaxe de cette commande est la suivante : head [options] <fichier> Par défaut, head affiche les 10 premières… …   Wikipédia en Français

  • Head (Unix) — Saltar a navegación, búsqueda head (que significa cabeza en inglés) es un programa de los sistemas tipo Unix que muestra las primeras líneas de uno o más archivos de texto. head imprimirá por defecto a la salida estándar las primeras diez líneas… …   Wikipedia Español

  • Head (Unix) — head is a program on Unix and Unix like systems used to display the first few lines of a text file or piped data. The command syntax is: head [options] lt;file name gt;By default, head will print the first 10 lines of its input to the standard… …   Wikipedia

  • head (Unix) — head (que significa cabeza en inglés) es un programa de los sistemas tipo Unix que muestra las primeras líneas de uno o más archivos de texto. head imprimirá por defecto a la salida estándar las primeras diez líneas de sus datos de entrada. Tanto …   Wikipedia Español

  • Head (Unix) — head утилита в head /var/log/messages Изменить количество выводимых строк можно указав ключ n <количество строк>: head n 20 /var/log/messages или <количество строк>: head 20 /var/log/messages Зачастую используется в качестве элемента… …   Википедия

  • head (Unix) — Pour les articles homonymes, voir Head. head est une commande UNIX qui permet d afficher les premières lignes de texte d un fichier ou de l entrée standard. La syntaxe de cette commande est la suivante : head [options] <fichier> Par… …   Wikipédia en Français

  • head (Unix) — У этого термина существуют и другие значения, см. Head. head  утилита в UNIX и UNIX подобных системах, выводящая первые n строк из файла, по умолчанию n равно 10: head /var/log/messages Изменить количество выводимых строк можно указав ключ n …   Википедия

  • Head — es un término inglés que significa cabeza . En español es utilizado para referirse a: Un programa informático típico de los sistemas Unix: head (Unix). En el ámbito de la informática también se utiliza en las tecnologías HTML, HTTP o CVS. El… …   Wikipedia Español

  • Head — Head: Сообщества, компании и марки High Energy Astrophysics Division  подразделение Американского астрономического общества. Head  компания производитель спортивного инвентаря. Компьютерные технологии head (Unix)  утилита Unix. См …   Википедия

  • Head (disambiguation) — In anatomy, the head of an animal is the rostral part (from anatomical position) that usually comprises the brain, eyes, ears, nose, and mouth.Metaphorically, Head may refer to a person who is a leader, supervisor or the like, such as the head of …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”