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

by Vivek Gite · 12 comments

tail is one of the best tool to view log files in a real time (tail -f /path/to/log.file). 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 much more.

Install MultiTail

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

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

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:

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:

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 12 comments… read them below or add one }

1 Henrik Nordvik 02.09.09 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.

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

3 xiao_haozi 02.09.09 at 9:52 pm

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

4 Meskalyn 02.10.09 at 11:26 am

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

5 Vivek Gite 02.10.09 at 11:43 am

@ Meskalyn, thanks for the heads up.

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

6 theToaster 02.10.09 at 7:41 pm

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

7 Stephen Clayton 02.10.09 at 7:59 pm

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

8 Adam Dempsey 02.18.09 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?

9 kpb 02.19.09 at 12:07 am

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

10 Intellignix 03.05.09 at 11:28 am

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

intelliginix.com

11 sanjay Katiyar 03.09.09 at 7:08 am

Is there any equivalent command in Fedora/CentOS?

12 Maroon Ibrahim 03.20.09 at 7:49 pm

Better to switch to Debian ;)

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post: