Follow a Log File Live with tail -f

Stream new log lines as they appear — the classic way to debug services on Linux.

LinuxlogstroubleshootingtailLow risk
Run tail -f /var/log/syslog to print the last 10 lines and keep displaying every new line; press Ctrl+C to stop.

01Command

Command
$ tail -f /var/log/syslog

02What it does

tail -f starts at the end of the file and keeps printing lines as they are appended, so you can watch what a service writes in real time. Add -n 50 to start with more context, or use tail -F (capital F) when the log is rotated, because it reopens the file by name after rotation. Combine with grep, e.g. tail -f /var/log/syslog | grep --line-buffered sshd, to filter live output.

03Risk

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • tail(1) — Ubuntu manpage
    Ubuntu · community · 2026-09-17
    Evidence: Ubuntu manpage describes --follow (-f) and -F, which follows the file by name and handles rotation
  • tail(1) — man7.org
    man7.org · community · 2026-09-17
    Evidence: Man page documents tail's -f option to follow a file as it grows and -n to select the number of lines

Last verified: 2026-09-19 · Category: Files & Folders

06Related solutions