54

Is there an easy way to do something like tail -f mylogfile but to have the changes of more than one file displayed (maybe with the file name added as prefix to each line)? Or maybe a GUI tool? I am running Debian.

88

Have you tried tail -f file1 file2? It appears to do exactly what you want, at least on my FreeBSD machine. Perhaps the tail that comes with a Debian system can do it too?

  • 1
    Yes. It works! Thank you. I'd never expected that it would be SO easy. – stofl Dec 4 '12 at 11:37
  • 10
    I usually use -F instead since a number of files may get truncated as I'm restarting server programs. – Arcege Dec 4 '12 at 23:37
  • 8
    My new favorite parameter combo is tail -qF *.log: -q to hide the file names and -F, as Arcege pointed out, to let tail follow the name rather than the descriptor because my log files are being rotated. – Denis Drescher Oct 4 '16 at 10:26
  • Validated also on Ubuntu 16.04 LTS – Ricardo May 12 '17 at 2:03
  • There is a limit to this. I have a folder with log files by PID for a worker that gets started for every new job in a queue (So lots of PIDs). If I tail -f /var/log/folder/* it returns the error "unable to execute /usr/bin/tail: Argument list too long" – flickerfly May 18 '18 at 16:20
2

For some reason, answers along the lines of tail -f file1 file2 wasn't quite what I had in mind.

I want to know what happened in several logs sort of most recently 'locally', regardless of the global chronological order.

To do that, I used something more like watch -n1 tail -n10 file1 file2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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