# The Start and End of a File: head and tail

head prints the first lines of a file and tail the last, ten unless -n says how many, and tail -f keeps watching a file and prints each new line as it's added.

![Cheat sheet for the lesson The Start and End of a File: head and tail: head prints the first lines of a file and tail the last, ten unless -n says how many, and tail -f keeps watching a file and prints each new line as it's added.](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/686a7ea963174bfcbae1367e56ca1efc.webp)

- Category: Bash
- Level: Apprentice
- Tags: head-and-tail, linux, log-file, unix
- Updated: November 10, 2026

Source: https://www.ask-codey.com/cheat-sheets/bash-head-and-tail-cheat-sheet
