How To Tail (View) Multiple Files on UNIX / Linux Console

by on February 9, 2009 · 15 comments· LAST UPDATED August 31, 2014

in , ,

The tail command is one of the best tool to view log files in a real time using tail -f /path/to/log.file syntax on a Unix-like systems. The program MultiTail lets you view one or multiple files like the original tail program. The difference is that it creates multiple windows on your console (with ncurses). This is one of those dream come true program for UNIX sys admin job. You can browse through several log files at once and do various operations like search for errors and more.

Install MultiTail On a Linux

Type the following command under Debian / Ubuntu Linux:
$ sudo apt-get update
$ sudo apt-get install multitail

RHEL/CentOS/Fedora/Red Hat Enterprise Linux user type the following yum command (first turn on EPEL repo for RHEL/CentOS v5.x/6.x and EPEL repo for RHEL/CentOS version 7.x):
# yum install multitail

If you are using FreeBSD, enter:
# portsnap fetch update
# cd /usr/ports/sysutils/multitail
# make install clean

Apple Mac OS X user type the following command:
$ brew install multitail

How To View Multiple Files Like tail Command

To view /var/log/messages and /var/log/auth.log, enter:
# multitail /var/log/messages /var/log/auth.log
Sample output:

Here is another output with lots of logfiles and command output in multiple windows in a terminal:

Multitail in action

Multitail in action

How do I run a command and view a log file?

Simply use command as follows:
# multitail /var/log/iptables.log -l "ping server.nixcraft.in"
OR
# multitail /var/log/httpd.log -l "netstat -nat"
The -l option allows command to execute in a window. Do not forget to use "'s if the external command needs parameter! (e.g. -l "ping host").

How do I display 3 logfiles in 2 columns?

To see all 3 files related to anti mail server gateway, enter:
# multitail -s 2 /var/log/maillog /var/log/FuzzyOcr.log /var/log/antivirus.log
multitail has many other useful options. Please read man page for further details:
man multitail

Further readings:
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 15 comments… read them below or add one }

1 Henrik Nordvik February 9, 2009 at 9:45 pm

Thanks for the tip!
Don’t forget xtail. I use it to monitor hits to multiple sites with logstalgia and other programs that are designed for regular tail, but works great with xtail too.

Reply

2 xiao_haozi February 9, 2009 at 9:51 pm

Been trying multitail off and on for a while now…but one thing that has always got me:
when viewing say access logs for webserver it has a good 5-10 delay it seems.

Reply

3 xiao_haozi February 9, 2009 at 9:52 pm

Edit: sorry missed adding ‘MINUTES’ to my last comment… my apologies.

Reply

4 Meskalyn February 10, 2009 at 11:26 am

Just a little mistake on FreeBSD : you wrote :
portsnap featch update
It’s fetch

Reply

5 nixCraft February 10, 2009 at 11:43 am

@ Meskalyn, thanks for the heads up.

@xiao_haozi, May be your server is not so busy…

Reply

6 theToaster February 10, 2009 at 7:41 pm

there is a “typo”:
# multilog /var/log/messages /var/log/auth.log
should be better multitail ;)

Reply

7 Stephen Clayton February 10, 2009 at 7:59 pm

Thanks for the post on Multitail. I’ve been looking for a tool like this for a long time…

Reply

8 Adam Dempsey February 18, 2009 at 9:44 am

Is it possible to view multiple files but in one view? Eg view the same log file from 5 different machines but all as one?

For example

Log Line from Machine 1
Log Line from Machine 1
Log Line from Machine 2
Log Line from Machine 4
Log Line from Machine 2

Is this possible?

Reply

9 kpb February 19, 2009 at 12:07 am

Great tip !! I’m going to try this out tonight !

Reply

10 Intellignix March 5, 2009 at 11:28 am

I could this when I am monitoring logs on my log server. Thank you!

intelliginix.com

Reply

11 sanjay Katiyar March 9, 2009 at 7:08 am

Is there any equivalent command in Fedora/CentOS?

Reply

12 Maroon Ibrahim March 20, 2009 at 7:49 pm

Better to switch to Debian ;)

Reply

13 jeffiam October 29, 2012 at 12:28 am

@sanjay run #yum install multitail

Reply

14 krishna bagal July 12, 2013 at 10:30 am

this is amazing i love to use this…

Reply

15 Scott August 31, 2014 at 2:30 pm

I usually run tail with grep so I’m only see what I’m looking for. Is that possible with multitail? I’ll snag it and play with it later.

Reply

Leave a Comment

Tagged as: , , , , , , , , , , ,

Previous post:

Next post: