The head
command is a command-line utility in Unix-like operating systems used to display the beginning or top portion of a text file.
By default, it shows the first 10 lines of a file, but users can specify a different number of lines to be displayed.
Common use cases for the head
command include previewing files, extracting headers from structured data, inspecting scripts, and viewing log file entries.
For example, running head -n 20 myfile.txt
would display the first 20 lines of the myfile.txt
file.
The head
command is a valuable tool for quickly inspecting the content of files without opening the entire file.