Hubbry Logo
search
logo
2230706

Head (Unix)

logo
Community Hub0 Subscribers
Write something...
Be the first to start a discussion here.
Be the first to start a discussion here.
See all
Head (Unix)

head is a program on Unix and Unix-like operating systems used to display the beginning of a text file or piped data.

The command syntax is:

By default, head will print the first 10 lines of its input to the standard output.

This displays the first 5 lines of all files starting with foo:

Many early versions of Unix and Plan 9 did not have this command, and documentation and books used sed instead:

The example prints every line (implicit) and quit after the fifth.

Equivalently, awk may be used to print the first five lines in a file:

However, neither sed nor awk were available in early versions of BSD, which were based on Version 6 Unix, and included head.

See all
User Avatar
No comments yet.