Clothing Mapquest Debt problem Top online casino Clopidogrel Women Buy ultram Online pharmacy tramadol Tube Buy clomid Physical therapist Lasix Cardiology Online gambling casino Car and insurance Cancer treatment clinic Sell real estate note Rims Auto insurance Flexeril Arizona auto insurance Buy viagra online Stock trading Poker star Safety Consolidate credit card Adipex p Online dating Plavix Erythromycin Modafinil Tadalafil vardenafil Home Adultfriendfinder Order xenical Evista Physician assistant Veterinarian Replica watch Diet pills phentermine Building Poker bonus Viagra information Timeshare Foreclosures Forex trading Spy ware Asthma Buy generic viagra Ceftin Online casino bonus Pharmacy Sexual Health Propecia Xenical diet pill The Buy ambien Buy cialis generic online Furniture Buy prozac 

Watch Multiple Logs in a Single Terminal

November 12th, 2008 by Nick Gauthier

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:

Before Watch Me

Using multiple terminals to watch logs

to this:

Using WatchMe to watch logs

Using WatchMe to watch logs

First, get Watch Me from github.

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.

This entry was posted on Wednesday, November 12th, 2008 at 12:53 pm by Nick Gauthier. Nick has been a developer at SmartLogic Solutions since January of 2008.

Tags: , ,

2 Responses to “Watch Multiple Logs in a Single Terminal”

  1. 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.)

  2. 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.

Leave a Reply