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

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.

ADVERTISEMENTS

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:
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
17 comments… add one
  • Henrik Nordvik Feb 9, 2009 @ 21:45

    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.

  • xiao_haozi Feb 9, 2009 @ 21:51

    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.

  • xiao_haozi Feb 9, 2009 @ 21:52

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

  • Meskalyn Feb 10, 2009 @ 11:26

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

  • 🐧 nixCraft Feb 10, 2009 @ 11:43

    @ Meskalyn, thanks for the heads up.

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

  • theToaster Feb 10, 2009 @ 19:41

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

  • Stephen Clayton Feb 10, 2009 @ 19:59

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

  • Adam Dempsey Feb 18, 2009 @ 9:44

    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?

  • kpb Feb 19, 2009 @ 0:07

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

  • Intellignix Mar 5, 2009 @ 11:28

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

    intelliginix.com

  • sanjay Katiyar Mar 9, 2009 @ 7:08

    Is there any equivalent command in Fedora/CentOS?

  • Maroon Ibrahim Mar 20, 2009 @ 19:49

    Better to switch to Debian 😉

  • jeffiam Oct 29, 2012 @ 0:28

    @sanjay run #yum install multitail

  • krishna bagal Jul 12, 2013 @ 10:30

    this is amazing i love to use this…

  • Scott Aug 31, 2014 @ 14:30

    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.

  • Nickchacha Dec 31, 2014 @ 5:59

    For earlier centos version your need first to install EPEL repository otherwise you will get

    [root@mail ~]# yum install multitail
    Loaded plugins: fastestmirror, security
    Loading mirror speeds from cached hostfile
    * base: mirror.wbs.co.za
    * extras: mirror.wbs.co.za
    * updates: mirror.wbs.co.za
    Setting up Install Process
    No package multitail available.
    Nothing to do

  • Jon Drews Dec 31, 2014 @ 18:19

    Most modern tail implementations can take more than one file inherently.

    tail -f /var/log/messages /var/log/auth.log /var/log/syslog

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.