Linux Command - head
head
- output the first part of files
Syntax
1 | head [OPTION] [FILE]... |
Description
Print the first 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name.
Option | Description |
---|---|
-n, –lines=K | print the first K lines |
-c, –bytes=K | print the first K bytes of each file. |
Example
show the head of log1
1 | head log1 |
show the last 10 commands
1 | history | head |
show the last 5 commands
1 | history | head -n 5 |