Forrest logo
back to the head tool

head:tldr:db727

head: Output the first few lines of a file.
$ head --lines ${count} ${filename}
try on your machine

The command "head --lines ${count} ${filename}" is used to display the first few lines of a text file specified by ${filename}, where ${count} represents the number of lines to be displayed.

The "head" command is commonly used in Unix-like operating systems to extract the beginning portion of a file. By default, it displays the first 10 lines of a file, but by using the "--lines" option, a specific number of lines can be specified.

In this command, "${count}" is a placeholder for the desired number of lines to be displayed. By replacing it with an actual number, you can control how many lines are shown. Similarly, "${filename}" is a placeholder for the name of the file you wish to display the lines of.

For example, if you have a file named "example.txt" and you want to display the first 5 lines, you would run the command "head --lines 5 example.txt". This will output the first 5 lines of "example.txt" to the console.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the head tool