Premières lignes d'un flux de données : head

La commande head permet de visualiser, par défaut, les 10 premières lignes d'un flux de données.

Syntaxe

head [-n] [fichiers ...]
Principales options :
-n Affiche les n premières lignes

Exemple

Afficher les 5 premières lignes du fichier /var/log/messages

$ head -5 /var/log/messages
May 13 04:54:06 rsyslogd: [origin software="rsyslogd" swVersion="4.6.4" x-pid="288" x-info="http://www.rsyslog.com"] rsyslogd was HUPed, type 'lightweight'.
May 14 04:54:03 rsyslogd: [origin software="rsyslogd" swVersion="4.6.4" x-pid="288" x-info="http://www.rsyslog.com"] rsyslogd was HUPed, type 'lightweight'.
May 15 04:54:03 rsyslogd: [origin software="rsyslogd" swVersion="4.6.4" x-pid="288" x-info="http://www.rsyslog.com"] rsyslogd was HUPed, type 'lightweight'.
May 15 04:54:03 rsyslogd: [origin software="rsyslogd" swVersion="4.6.4" x-pid="288" x-info="http://www.rsyslog.com"] rsyslogd was HUPed, type 'lightweight'.
May 16 04:54:03 rsyslogd: [origin software="rsyslogd" swVersion="4.6.4" x-pid="288" x-info="http://www.rsyslog.com"] rsyslogd was HUPed, type 'lightweight'.
$

Etiquettes: