Skip to content

The tail command

Print the last lines of files. Prints the last 10 lines of each file, or of what is piped into it. Log files grow at the end, so tail is the usual way to see what happened most recently.

Usage

tail [OPTION]... [FILE]...

Options

-n N, --lines=Nthe last N lines instead of 10
-n +Neverything from line N to the end
-Nshort for -n N

Examples

  • tail app.logThe last 10 lines
  • tail -n 3 app.logThe last 3 lines
  • tail -n +2 data.csvEverything but the header line

Learn it step by step

learner@sandbox: ~bash (practice)
Note: Try tail here: your home directory has sample files. Press Try beside an example, or type your own.

A practice shell in your browser that behaves like bash on Linux for these commands. Nothing you type leaves the page.