Skip to content

tail command

Show the last lines of a file, or follow it as it grows.

On this page

Syntax

tail [options] [file…]

Provided by the coreutils package. Run man tail for the full manual.

Common options

OptionWhat it does
-n NShow the last N lines (default 10)
-n +NStart from line N
-fFollow: keep printing new lines
-FFollow by name; survives log rotation
-c NShow the last N bytes
--pid=PIDStop following when PID exits

Examples

  1. Last 10 lines

    tail /var/log/syslog
  2. Last 50 lines

    tail -n 50 app.log
  3. Follow a log live

    tail -f /var/log/nginx/error.log
  4. Follow through log rotation

    tail -F /var/log/app.log
  5. Follow and filter

    tail -f access.log | grep 404
  6. Skip the header line of a CSV

    tail -n +2 data.csv
  7. Follow several files

    tail -f /var/log/nginx/*.log

tail guides

← All Linux commands · Suggest a fix

Back to top