Reputation: 338
I have a log file, which can only be appended to. I want to pipe this log file to console, so that once new data comes to the log file, the console also reflects the new piece of data. When there is no data to be appended, the console should block there waiting for updates.
It's like a proxy server, redirecting file updates to console.
How to achieve this using bash?
Thank you.
Upvotes: 0
Views: 977
Reputation: 10663
Use tail:
tail -f logfile
-f
means follow which is exactly what you need.
Also, in case you run into some problems with file becoming inaccessible, try using -F
Upvotes: 1