How-To: tail multiple files with multitail

1 minute read

Many times you will end up tailing multiple files simultaneously. There is a sweet linux utility called multitail that will let you tail multiple files at the same time within the same shell.

And not only will you be able to tail multiple files! You will also be able to run multiple commands and tail their outputs!

multitail allows you to tail multiple files within the same window. Outputs can be either merged together or shown in split panes either horizontally or vertically.

Installation

On Debian, installation is pretty straightforward and only needs a bit of _apt-get_ing:

# apt-get install multitail

Usage

There is a tons of ways to use that command. The man page is filled with different switches that can be use to better customize the output.

I am going to show you a few ways to use it.

First, let’s aggregate the output of 2 log files within the same window. This is done by using a command like:

# multitail -i /var/log/daemon.log -I /var/log/auth.log

This tells multitail to tail files /var/log/daemon.log and /var/log/auth.log and to merge the output of /var/log/auth.log into the first window.

Multitail merged output You can also have the same files’ output in 2 different panes:

# multitail -i /var/log/daemon.log -i /var/log/syslog

This will have the 2 files displayed in 2 different panes split across the horizontal axis.

# multitail -s 2 -i /var/log/daemon.log -i /var/log/syslog

will have the same files split across the vertical axis.

Multitail Split Output

As said earlier, multitail can also tail the output of commands. In a nutshell, to do this, you will need to use -l in place of -i and -L instead of -I.

$ multitail -l "ping 8.8.4.4" -ec 'time=4[0-9]\.?[0-9]* ms' -L "ping 8.8.8.8"

Will ping 8.8.4.4 and ping 8.8.8.8 simultaneously and merge the outputs within the same window. On top of that, we will highlight the chunks of output that match time=4[0-9].?[0-9]* ms, e.g any ping’s which RTT is between 40 and 50ms.

Multitail ping merged output There is much more possibilities offered by multitail. As always, the manpage is the source of truth. The developer has gathered a few example on his example page.