Technopedia Center
PMB University Brochure
Faculty of Engineering and Computer Science
S1 Informatics S1 Information Systems S1 Information Technology S1 Computer Engineering S1 Electrical Engineering S1 Civil Engineering

faculty of Economics and Business
S1 Management S1 Accountancy

Faculty of Letters and Educational Sciences
S1 English literature S1 English language education S1 Mathematics education S1 Sports Education
teknopedia

teknopedia

teknopedia

teknopedia

teknopedia

teknopedia
teknopedia
teknopedia
teknopedia
teknopedia
teknopedia
  • Registerasi
  • Brosur UTI
  • Kip Scholarship Information
  • Performance
  1. Weltenzyklopädie
  2. head (Unix) - Teknopedia
head (Unix) - Teknopedia
head
software
GenereUtility
SviluppatoreDavid McKenzie, Jim Meyering, e altri
Sistema operativoMultipiattaforma
Licenzacoreutils: GPLv3
(licenza libera)
Modifica dati su Wikidata · Manuale

head (dalla lingua inglese head, testa, per estensione inizio) è un comando dei sistemi Unix e Unix-like, e più in generale dei sistemi POSIX[1], che mostra sullo standard output le prime linee di uno o più file di testo, o dei dati provenienti dallo standard input. È un tipo di filtro.

Sintassi

[modifica | modifica wikitesto]

La sintassi generale del comando head è la seguente:

head [opzioni] [--] [file1 [file2 …] ]

I parametri facoltativi file specificano i nomi dei file di cui mostrare le prime linee. Se non sono specificati, head mostra le prime linee dei dati provenienti dallo standard input.

Il doppio trattino -- (facoltativo) indica che i parametri successivi non sono da considerarsi opzioni.

Il comportamento predefinito prevede di mostrare le prime 10 linee di dati.

Tra le opzioni principali vi sono:

-n num
Mostra il numero di linee iniziali specificate dal parametro num.
-num
Mostra il numero di linee iniziali specificate da num (sintassi storica).

Esempi

[modifica | modifica wikitesto]

Mostra le prime 10 linee del file elenco.txt:

head -n 10 elenco.txt

Mostra le prime 20 linee del file elenco1.txt e le prime 20 linee del file elenco2.txt:

head -n 20 elenco1.txt elenco2.txt

Cerca nella directory corrente e nelle sue subdirectory i file i cui nomi hanno l'estensione .txt tramite il comando find, e visualizza solo le prime 5 linee dei risultati mettendolo in una pipeline software con head:

find . -type f -print | head -n 5

Note

[modifica | modifica wikitesto]
  1. ↑ (EN) head, su The Open Group Base Specifications Issue 6 IEEE Std 1003.1, 2004 Edition. URL consultato il 3 giugno 2008.

Voci correlate

[modifica | modifica wikitesto]
  • tail – Mostra le ultime linee di un file.

Collegamenti esterni

[modifica | modifica wikitesto]
  • (EN) head: Output the first part of files, su GNU Coreutils manual. URL consultato il 3 giugno 2008.
  • (EN) Documentazione su head di FreeBSD, su freebsd.org.
V · D · M
Programmi Unix/Unix-like con interfaccia a riga di comando e comandi interni della shell unix
File systemcat · cd · chattr · chmod · chown · chgrp · cksum · cmp · cp · du · df · fdisk · file · fsck · fuser · gzip · ln · ls · lsattr · lsof · mkdir · mknod · mount · mv · pwd · rm · rmdir · split · tar · touch · umount · umask
Processiat · chroot · crontab · exit · kill · killall · nice · nohup · pgrep · pidof · pkill · ps · pstree · sleep · time · top · wait
Ambiente utentealias · env · export · finger · id · logname · mesg · newgrp · passwd · su · sudo · uname · uptime · w · wall · who · whoami · write
Elaborazione testoawk · comm · cut · diff · ed · ex · fmt · head · iconv · join · less · more · paste · sed · sort · tail · tr · uniq · vi · wc · xargs
Script di shellbasename · dirname · echo · expr · false · printf · test · true · unset
Retedig · nslookup · ifconfig · netstat · ping · rcp · rlogin · route · netcat · traceroute
Ricerchefind · grep · strings
Amministrazionedmesg · groupadd · groupdel · groupmod · mdadm · shutdown · useradd · userdel · usermod
Altribanner · bc · cal · clear · date · dd · lp · man · size · tee · tput · yes
  Portale Informatica: accedi alle voci di Teknopedia che trattano di informatica
Estratto da "https://it.wikipedia.org/w/index.php?title=Head_(Unix)&oldid=125669372"

  • Indonesia
  • English
  • Français
  • 日本語
  • Deutsch
  • Italiano
  • Español
  • Русский
  • فارسی
  • Polski
  • 中文
  • Nederlands
  • Português
  • العربية
Pusat Layanan

UNIVERSITAS TEKNOKRAT INDONESIA | ASEAN's Best Private University
Jl. ZA. Pagar Alam No.9 -11, Labuhan Ratu, Kec. Kedaton, Kota Bandar Lampung, Lampung 35132
Phone: (0721) 702022