Follow a log file live with tail -f
tail -f prints the last lines of a file and keeps running, showing every new line the moment it is written — the standard way to watch logs without refreshing.
Run `tail -f /var/log/system.log` to stream new lines as they are appended; press Control-C to stop.
01Command
Command
$ tail -f /var/log/system.log
tail -f ~/dev/app/debug.log | grep --line-buffered ERROR02What it does
By default tail -f starts with the last ten lines (-n controls that count) and then blocks, re-reading the file as it grows. The less-remembered variant -F follows the same file name even after log rotation replaces the file with a new one, which matters for app logs that rotate daily.
03Risk
!Warning: tail -f never exits on its own; use Control-C to stop it, and prefer -F when the target log rotates.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- tail — display the last part of a file (macOS)Evidence: Documents the -f follow option and its variants -F and -n.
Last verified: 2026-09-17 · Category: Files & Folders