Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a program that for each run generates a new log file. To watch what's going on, I'd like to tail -f the log - only problem is that I don't actually know the file name in advance.

So, is there a way to follow all files that match a certain (shell glob) pattern? I guess I could easily script something like this, but I'm wondering if there's already a solution out there.

share|improve this question
Possible duplicate superuser.com/questions/181517/… –  Peter Lundgren Nov 1 '12 at 12:40

1 Answer 1

up vote 4 down vote accepted

I don't think there's a direct way to do with with tail without knowing the name - if you knew that then tail --follow=name --retry would work and it would wait for the file to appear and then start following it.

I'd suggest writing a little shell script that uses inotifywait to watch for the file appearing and then starts tail -f to follow it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.