In the next article we are going to take a look at Multitail. This is a Tail-like program, the only difference is that with Multitail, we will be able to read multiple files (usually log files) at the same time, applying different colors to them. It will show us all the open files in a single window of the terminalIf there is any change to the file, it will change instantly. The main utility of this tool is to monitor log files. It is a very useful tool for Gnu / Linux system administrators.
For those who don't know, Tail is a Gnu / Linux program used to read a few lines from the end of a large file. By default the last 10 lines are shown, but this number may vary depending on user specifications.
Multitail Installation
Multitail is available in the official repositories from Ubuntu. I have installed it in both version 16.04 and 17.10.
First of all, we will start by updating the cache of the package repositories of our Ubuntu operating system with the following command in the terminal (Ctrl + Alt + T):
sudo apt update
We will continue installing Multitail, for this we will execute the following command in the same terminal:
sudo apt install multitail
With this Multitail should be installed. Now run the following command to check if it is installed correctly:
multitail -V
As you can see in the screenshot, the version of Multitail installed is 6.4.2.
View single log file with multiple queue
Although Multitail is used to view multiple log files in a single terminal window, it can also be used to view a single log file. Run the following command to open the log file /var/log/auth.log:
multitail /var/log/auth.log
As can be seen in the above screenshot, a single file opens. The view of this will be updated as the file changes. We will can exit Multitail press the 'q' key.
View multiple log files with Multitail
As I have already written above, the main function of this program is to be able to view multiple log files in a single terminal window. Files will be placed vertically by default
Run the following command to see /var/log/auth.log y /var/log/kern.log vertically:
multitail /var/log/auth.log /var/log/kern.log
As can be seen from the screenshot above, the file /var/log/auth.log opens in the top half and the file /var/log/kern.log opens in the lower half.
We can also place the filesIn this case /var/log/auth.log y /var/log/kern.log horizontally using the following command:
multitail -s 2 /var/log/auth.log /var/log/kern.log
It must be said that the value of the -s argument is 2 because I am opening 2 files in this example. If we want to open 3 files, then the value of -s must be 3.
List open files
If we press the 'b' key se will display a list of open files, as it's shown in the following. In this example I have 2 files open, the first one /var/log/auth.log is numbered 00 and the second /var/log/kern.log it is numbered 01. If you are not interested in selecting any files, just press Ctrl + G to cancel the selection menu.
We can press the up and down arrow keys to move the selector and press Enter to select the file we want to consult. For this example I selected the first file /var/log/kern.log y displayed on screen through a separate section. Now we can press the up and down arrow keys to navigate through the file.
Once we finish reading this file, you should press 'q' to return to the main window by Multitail.
View multiple files with different colors
We can also set different colors for different open files with Multitail. For example, we can open /var/log/auth.log in yellow and /var/log/kern.log in red with the following command:
multitail -ci yellow /var/log/auth.log -ci red /var/log/kern.log
As you can see from the screenshot above, Multitail opened /var/log/auth.log in yellow and /var/log/kern.log in red.
If someone wants to know more about this program and its features, they can consult the section What can Multitail do for users?.