Where to start First steps track · 15 stages
Linux Labs

tail — the last lines and following a log

cheat sheet · Ubuntu 24.04 · GNU coreutils 9.4 https://lab.dimsanych.ru/en/wiki/tail/

Cheat sheet

  • tail app.log the last 10 lines
  • tail -n 50 app.log the last 50 lines
  • tail -n +2 data.csv everything from line 2 on
  • tail -f /var/log/nginx/error.log follow; Ctrl+C to quit
  • tail -F app.log follow and survive log rotation
  • tail -n 0 -f app.log only new lines, no old ones
  • tail -f a.log b.log two files at once, with names
  • tail -f app.log | grep --line-buffered ERROR follow errors only

Options

-n 50 and the short form -50 are the same. The +N in -n +N means "starting at line N". Full list — man tail.

Loading…