head

Contents

Roadmap info from roadmap website

Head Command

The head command in Linux is a text processing utility that allows a user to output the first part (or the β€œhead”) of files. It is commonly used for previewing the start of a file without loading the entire document into memory, which can act as an efficient way of quickly examining the data in very large files. By default, the head command prints the first 10 lines of each file to standard output, which is the terminal in most systems.

head file.txt

The number of output lines can be customized using an option. For example, to display first 5 lines, we use -n option followed by the number of lines:

head -n 5 file.txt
#ready #online #reviewed #linux #operative-system