Skip to content
Advertisement

How to follow latest log file with tail -f?

I have a dir that saves a fresh log file for each run, so I use the following command to follow the latest log file:

JavaScript

So my question would be if there is any way to jump from one file to the next, if there is a newer log file available without having to stop the latest tail -f and rerunning it?

Advertisement

Answer

What you could attempt is something like this:

JavaScript

run the following in another shell

JavaScript

You can also run this in a single command as:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement