Search notes:

Shell command: head

head is similar to tail, but return's a file's (or stdin's) first lines:
head ~/.profile
In order to get a file's first n lines, the -n option can be used:
head -n 20 ~/.profile

Getting arbitrary lines

In order to display arbitrary lines from a file, sed can be used.
For example, the following command gets lines 15 through 20:
$ sed -n /path/to/file -e 15,20p
The following command prints lines 42 and 99:
$ seq 1 100 | sed -n -e '42p;99p'

See also

A useful example of head is to show a directory's largest n files.
The PowerShell command get-content -first n and get-content -last n.
Shell commands

Index