Many Linux users know the Tail tool, which prints the number of last lines of text or stream. It is used as a diagnostic tool for checking changes in files. In today’s article we will present a much improved version of this tool – MultiTail.
The application allows you to preview one or more files, although its strength lies in the ability to divide the screen into multiple windows for each file separately. The tool is able to color the syntax, which makes it easy to preview system logs and filter lines with regular expressions. The application has an interactive menu for editing regular expressions, as well as creating and removing windows.
Combines 2 log files in one window:
multitail /var/log/apache/access.log -I /var/log/apache/error.log
Shows 3 log files in two columns:
multitail -s 2 /var/log/apache/access.log /var/log/messages /var/log/mail.log
It shows 5 log files, two of which have been merged and everything is shown in two columns, one of which is shown in a separate column on the left:
multitail -s 2 -sn 1,3 /var/log/apache/access.log -I /var/log/apache/error.log /var/log/messages /var/log/mail.log /var/log/syslog
Combines the outputs of two ping commands and removes text: 64 bytes received from only one of them:
multitail -l "ping 192.168.0.1" -ke "64 bytes from" -L "ping 192.168.0.2"
Shows the current output of the ping command and, if the timeout is printed, sends a message to all currently logged in users:
multitail -ex timeout "echo timeout | wall" -l "ping 192.168.0.1"
One window will show all TCP connections and their status changes using the netstat command. In the second window you will see connected log files: access.log and error.log from Apache:
multitail -R 2 -l "netstat -t" /var/log/apache/access.log -I /var/log/apache/error.log
Command, as above, only that you have added copying the output to the netstat.log file:
multitail -a netstat.log -R 2 -l "netstat -t tcp" /var/log/apache/access.log -I /var/log/apache/error.log
Shows two linked log files in one window, but each of them will receive different colors, allowing you to easily distinguish between lines:
multitail -ci green /var/log/apache/access.log -ci red -I /var/log/apache/error.log