How to Follow a Log File in Real Time in Linux (tail -f)
tail -f prints the last lines of a file and then keeps running, displaying new lines as they're written — commonly used to watch logs live.
Published October 3, 2026
tail -f prints the last lines of a file and then keeps running, displaying new lines as they're written — commonly used to watch logs live.
Key points
- Extremely common for watching an application or server log as new events happen: tail -f /var/log/nginx/access.log
- tail -n 50 shows just the last 50 lines without following; combine both with tail -n 50 -f
- Press Ctrl+C to stop following and return to the shell prompt
Example
tail -f /var/log/nginx/access.log