Linux tail -f Command: Follow Log Files Live (nginx, apps, journalctl)

tail -f linux - custom-tailf-featured.png

tail -f is one of the most searched Linux commands — operators use it during deploys, incidents, and “why is login failing?” sessions. It streams new lines appended to a file until you press Ctrl+C.

Broader logging: journalctl,
nginx log analysis,
Docker logs.

When to Use tail -f

You already know the log path and need to see errors as they happen — not a full-text search across history.

live stream
incident

Follow a Classic Log File

Start with the last N lines so you are not flooded.

bashnginx error log
sudo tail -n 100 -f /var/log/nginx/error.log
tail -f
-n

systemd: journalctl -f

When you do not know the file path — filter by unit.

bashservice
sudo journalctl -u nginx -f --since today
journalctl -f
-u

Rotated and Compressed Logs

logrotate may move files; search archives with zgrep or tail the current file only.

basharchive
sudo zgrep 'error' /var/log/nginx/error.log.1.gz | tail
logrotate
.gz

Multiple Sources

Compose stacks and multitail for several files at once.

bashcompose
docker compose logs -f --tail=50 web
multitail
compose

Production Habits

On busy servers, narrow with grep; ship logs to central storage for long retention.

bashfilter
sudo tail -f /var/log/auth.log | grep --line-buffered 'Failed password'
grep pipe
central logs

Confirm You See Events

Reproduce the issue in another terminal while tail runs.

reproduce
Ctrl+C

Quick Reference

  • tail -n 100 -f FILE to follow with context
  • systemd: journalctl -u UNIT -f
  • Filter: pipe to grep --line-buffered

Related tutorials

Diagrams are original illustrations by Gnome IT Solutions. Tutorial text © Gnome IT Solutions.