$title = "Displaying the first lines of a file - head"; $area = "Unix Support"; $metadata = "unix, commands, file, display, head"; $pfloc = ""; require '/usr/local/wwwdocs/ucs/fragments/header.phtml'; require '/usr/local/wwwdocs/ucs/fragments/header-bc.phtml'; ?>
To display the first 10 lines of a text file use the command:
head filename
To display the first 10 lines of a file:
head /usr/local/doc/vi.txt
This displays the first 10 lines of the file vi.txt which is in the directory /usr/local/doc/
To display the first 5 lines of several files:
head -5 *.xdh
This displays, one after the other, the first 5 lines of each file with the extension .xdh in the current directory.
The first line of each file is shown as:
==> filename <==
require '/usr/local/wwwdocs/ucs/fragments/footer.phtml'; ?>