Spent 20 minutes on a remote session last month with a developer who was convinced their logging service had stopped writing entirely. It hadn't. They were just running plain tail and wondering why nothing new appeared. If tail follow file changes isn't working for you, the fix is almost always one flag away. But there are a few nastier causes worth knowing about too.
TL;DR
Plain tail and cat print file contents once and exit. To make tail follow file changes, use tail -f for basic follow mode or tail -F for log files that get rotated. If you still see nothing, check permissions with ls -l and confirm the file is actually being updated with stat.
Key Takeaways
- tail follow file changes requires the
-for-Fflag. Plaintailexits immediately after printing. tail -ffollows the inode. If the file is rotated or recreated, it loses track. Usetail -Finstead for log files.- If
tail -fshows nothing at all, check permissions first, then confirm the file is actually changing withstat. - Writer-side buffering can make updates invisible even when the process is running fine. The fix is on the application side, not the tail side.
cathas no follow mode. It will never show new content. Usetail -fortail -F.
At a Glance
- Difficulty: Easy
- Time Required: 15 mins
- Success Rate: 90% of users
What Causes Tail Follow File Changes to Stop Working?
The most common reason is the simplest one: people run tail /var/log/app.log or cat /var/log/app.log and expect it to keep updating. It won't. Both commands read the file once and exit. That's it. There's no magic background process keeping the output alive. To get tail follow file changes behaviour, you have to tell tail explicitly to stay open with -f or -F.
But say you're already using tail -f and still seeing nothing new. That's where it gets more interesting. Here are the actual causes in rough order of how often I see them:
- No follow flag at all. Plain
tailorcatused instead oftail -f. Accounts for probably 60% of these calls. - File rotation. The writing process rotates its log file, creating a new file at the same path.
tail -ffollows the original inode, so it keeps watching the old renamed file and never sees the new one. The terminal goes quiet. - Writer-side buffering. The application writing to the file is buffering output in memory and only flushing to disk in large chunks or at intervals. The file size doesn't change for minutes at a time even though the process is running fine.
- Permission issues. You don't have read access to the file or its parent directory.
tail -fmight open without error but show nothing, or throw a permission denied message. - Wrong file path. The process is writing to a different location than you think. Symlinks, relative paths, and environment-specific log directories catch people out regularly.
- File truncation or in-place rewriting. Some applications don't append. They rewrite the whole file from scratch each time.
tail -fonly shows content added to the end, so a truncate-and-rewrite cycle can look like nothing is happening.
The Linux man page for tail covers the technical distinction between inode-following and name-following in detail if you want the full picture. For most people, the practical takeaway is: -f for simple cases, -F for anything involving log rotation.
One thing worth flagging: if you're trying to read systemd journal logs with tail -f on a file under /run/log/journal/, you're going to have a bad time. Those are binary files. Use journalctl -f instead. tail is designed for plain text streams appended line by line, and that's where it works well.
Tail Follow File Changes: Quick Fix
Nine times out of ten, this is all you need.
Enable Follow Mode with tail -f Easy
- Stop whatever you're currently running.
PressCtrl+Cto exit plaintailorcat. - Run tail with the -f flag.
tail -f /path/to/file
This keeps the command open and prints each new line as it's written to the file. You'll see the cursor sit there waiting. That's correct behaviour. - Verify it's working.
Trigger some activity in the writing process (make a request, generate an event, whatever applies). New lines should appear in your terminal within a second or two. If they do, you're sorted.
-f alone will break silently after rotation.More Tail Follow File Changes Solutions
Use tail -F for Rotated Log Files Easy
- Understand the difference first.
tail -ffollows the inode of the file it opens. When logrotate renamesapp.logtoapp.log.1and creates a freshapp.log,tail -fkeeps watching the renamed file. You see nothing new.tail -Ffollows the filename instead, so it notices when the path points to a new file and switches automatically. - Run tail with the -F flag.
tail -F /path/to/file
You'll see a message liketail: '/path/to/file' has been replaced; following new filewhen rotation happens. That's the flag doing its job. - Verify across a rotation event.
If you can trigger a log rotation manually (e.g.sudo logrotate -f /etc/logrotate.conf), do it whiletail -Fis running. It should print the replacement notice and continue showing new output from the fresh file without you having to restart anything.
Check File Permissions Easy
- Check who owns the file and what permissions are set.
ls -l /path/to/file
Look at the owner, group, and permission bits. A file owned byrootwith mode640won't be readable by a regular user. - Try with sudo to confirm the cause.
sudo tail -f /path/to/file
If this works and plaintail -fdoesn't, the problem is definitely permissions, not the command itself. - Fix access properly.
Rather than always running as root, add your user to the relevant group. For example, many distros put log files in theadmgroup:sudo usermod -aG adm yourusername. Log out and back in for the group change to take effect.
Confirm the File Is Actually Being Updated Easy
- Check file metadata with stat.
stat /path/to/file
Note the file size and theModifytimestamp. Wait 15 to 30 seconds and run it again. - Compare the two outputs.
If the size and modification time haven't changed, the writing process is either not running, writing to a different path, or buffering output and not flushing to disk. - Check the inode number.
ls -li /path/to/file
The first column is the inode. If the inode changes between checks, the file is being replaced rather than appended to. This is whytail -floses track. Switch totail -F. - Find where the process is actually writing.
If you control the writing process, check its configuration for the log path. Or uselsof -p <PID>to see every file the process has open. The actual log file will show up there.
Advanced Tail Follow File Changes Fixes
If the quick and intermediate fixes haven't sorted it, one of these less obvious causes is probably the culprit.
Deal with Writer-Side Buffering Medium
- Identify whether buffering is the cause.
Ifstatshows the file size is growing, but only in large jumps every few minutes rather than line by line, the writing process is buffering. The file is being updated, just not as frequently as you'd expect. - Check the polling interval on tail.
tail -f -s 1 /path/to/file
The-sflag sets the sleep interval between checks in seconds. Default is usually around 1 second already, but making it explicit can help on some systems. This won't fix buffering but it rules out tail itself being the delay. - Fix the writer if you control it.
If it's a Python script, run it withpython -u script.pyfor unbuffered output, or callsys.stdout.flush()after each write. For C programs, usefflush(stdout)or setsetbuf(stdout, NULL). For shell scripts,echois typically line-buffered already, but redirecting through a pipe can introduce buffering. Usestdbuf -oLto force line buffering:stdbuf -oL your_command >> /path/to/file. - If you don't control the writer, accept the delay.
Some applications only flush logs on a schedule or when the buffer fills. In that case,tail -fwill show updates, just not in real time. There's nothing you can do on the monitoring side to change that.
Handle In-Place Rewriting and Truncation Medium
- Detect truncation.
Runstat /path/to/filerepeatedly. If the file size drops back to zero or a small value periodically, the process is truncating and rewriting rather than appending.tail -fonly shows content added to the end of the file. A truncate event resets the position and you may see nothing or see the same content repeated. - Check whether tail -F handles it.
Some truncation patterns are treated as file replacement events. Trytail -F /path/to/fileand watch whether it picks up content after the truncation. On GNU coreutils,tail -fdoes actually detect truncation and resets its position, so you should see new content appear after the truncation. But behaviour varies by system. - Consider a different monitoring approach.
If the file is being rewritten entirely rather than appended to,tailisn't the right tool. You might be better off usingwatch cat /path/to/fileto see the full current state on a refresh interval, or writing a small script that diffs the file contents between reads. The GNU coreutils documentation for tail explains exactly how truncation detection works under the hood if you want to get into the specifics.
tail -f handles it fine: tail -f /var/log/app.log /var/log/error.log. Each new line is prefixed with the filename so you know which file it came from. Add -q to suppress those headers if you'd rather not see them. For a broader look at Linux log management, HowToGeek's tail command guide covers the common use cases well.If you're still not seeing tail follow file changes work after trying these steps, it's likely a permissions issue or a non-obvious file path that's easier to trace with a second pair of eyes. Our Linux remote support team can connect in minutes and get it sorted.
Get remote helpPreventing Tail Follow File Changes Problems
Most of these problems are avoidable with a couple of habits. Here's what actually matters, in order of importance:
1. Default to tail -F, not tail -f. For any production log file, tail -F is the safer choice. It handles rotation automatically and doesn't go silent after a logrotate run. There's no real downside to using it over -f for normal files. Make it your default and you'll avoid the most common version of this problem entirely.
2. Get permissions right from the start. If your monitoring user can't read the log directory, you'll get nothing and it won't always be obvious why. Set up group membership properly (usually the adm group on Debian-based systems) rather than relying on sudo for routine log watching. Running everything as root because it's easier is a bad habit that creates bigger problems later.
3. Know your log format before picking your tool. Plain text files appended line by line: use tail -F. systemd journal: use journalctl -f. Binary or structured formats: use whatever the application provides. Forcing tail onto a binary log file produces garbage output and wastes time. If you're working with Linux permission structures more broadly, our Linux file permissions guide covers the common gotchas in detail.
4. Configure your applications to flush promptly. If you control the writing process, line-buffered output is almost always the right setting for log files. Delayed flushing makes debugging harder and gives you a false impression that nothing is happening. It's a small configuration change that saves a lot of confusion.
5. Standardise your log paths. Log files scattered across custom directories with non-standard names are a maintenance headache. If you're setting up a new service, put logs somewhere predictable, document the path, and set up rotation with logrotate from day one. Future you will be grateful. For teams managing multiple Linux servers, our Linux server monitoring setup guide covers building a consistent logging workflow.
Tail Follow File Changes: Summary
The core of tail follow file changes is simple: plain tail and cat don't follow anything. They read and exit. Add -f to keep tail running and watching for new content. Switch to -F if the file might be rotated or recreated, which covers most real-world log files. If follow mode still shows nothing, check permissions with ls -l, confirm the file is actually changing with stat, and check the inode with ls -li to see if the file is being replaced rather than appended to. Writer-side buffering is the trickiest cause because everything looks fine from the outside, but the fix is on the application side, not the tail command. Sort those five things and tail follow file changes will work exactly as expected.


