Introduction
In the Linux environment, one of the most useful commands for inspecting text files is head. Its main function is to display the first lines of a file, allowing a quick view without needing to load the entire content into memory. This tool is especially valuable when working with extensive logs, configuration files, or any document where you need to verify the format or initial headers.
Basic Syntax
The simplest way to use head is to simply write its name followed by the file name:
head nombre_del_archivo
This way, head will by default display the first ten lines of the specified file. If no file is provided, head reads from standard input, allowing it to be combined with pipes and other commands.
Most Used Options
This post is also available in ESPAÑOL.