The pattern for displaying the first N lines of a file via the terminal is:

head -N filename

Example

head -3 days

Output

1
2
3
Monday 
Tuesday
Wednesday

The pattern for displaying the last N lines of a file via the terminal is:

tail -N filename

Example

tail -3 days

Output

1
2
3
Friday
Saturday
Sunday

Comments