Have you ever opened 4 terminal windows, SSHed each one into a server, and ran tail on all of them to watch 4 log files?
Have you ever had a terminal window open whose sole purpose was to run “tail my_log” over and over again to look at the output of a file?
It’s a pain, isn’t it?
Introducing “Watch Me” a simple ruby script that allows you to watch multiple log files simultaneously.
go from this:
to this:
First, .
Then, try out the example by following these instructions:
1) Open 3 terminal windows in the watch_me directory
2) In the first terminal, run:
$ ./examples/rander.rb > rander.1.log
3) In the second terminal, run:
$ ./examples/rander.rb > rander.2.log
4) In the third terminal, run:
$ ./watch_me.rb rander.1.log rander.2.log
You can customize the behavior with the “r” and “l” flags.
./watch_me.rb -l 60 -r 1 file1 file2
Will use 60 terminal lines and refresh every 1 second. This lets you see even more of your files, and see it in near real-time.
Enjoy.


You should definitely check out GNU Screen. It’s documentation is a bit difficult to wade through, but this would be a good use case for using split windows within screen. (and besides that, screen is an essential part of any frequent terminal user’s toolkit.)
Hey Nicholas,
I love screen, but it still requires you to run the command 4 times instead of just one command, and it requires a lot more keystrokes to set up.
This way lets you change quickly which files you’re accessing by just typing them in the command.
Also to pre-empt another expected comment, yes I know about tail -f.
It is not true that you MUST run the command 4 times. If you always want to watch the same four logs on the same four hosts, you can quite easily automate this. With a bit more scripting magic you an create a utility which will automate watching an arbitrary set of logs. You might also want to check out the standard UNIX command ‘watch’. Lastly, I would encourage you to read about named pipes.
Hey Erik,
Yep, this post is pretty dated and it’s a pretty poor way of doing the task. As Dan pointed out GNU screen is a great utility, and like you pointed out I can do it with watch.
In my script I also failed to use optparse for options. Really, it just goes to show how much you hate your own code after a while :-D
-Nick