Tutorial on using Multitail command on Linux

Tutorial on using Multitail command on Linux

MultiTail is a software used to monitor multiple documents at the same time, similar to the tail command function.

The difference between it and tail is that it will open multiple windows in the console, making it possible to monitor multiple log files at the same time.

What is MultiTail

MultiTail is an open source ncurses utility that can be used to display the last few lines of a log file in a single window or shell, in real time just like the tail command which splits the console into more sub-windows (much like the screen command which displays multiple log files to standard output). It also supports color highlighting, filtering, adding and removing windows, etc.

feature

  • Multiple input sources.
  • Use color display of regular expressions in cases where important information is present.
  • Line filtering.
  • Interactive menu for removing and adding shells.

The multitail command is useful when you want to view activity on multiple files (especially log files) at the same time. It works like the tail -f command in a multi-window form. That is, it shows the bottom of those files and the new lines that were added. Although generally simple to use, multitail provides some command-line and interactive options that you should be aware of before you start using it.

Basic multitail usage

The simplest way to use multitail is to list the names of the files you want to view on the command line. This command splits the screen horizontally (i.e. top and bottom) and displays the bottom part of each file along with the updates.

$ multitail /var/log/syslog /var/log/dmesg

The display will be split like this:

+-----------------------+
| |
| |
+-----------------------|
| |
| |
+-----------------------+

Each file has a line showing the file number (starting at 00), the file name, the file size, and the date and time the most recent contents were added. Each file will be allocated half the space, regardless of its size or activity. for example:

content lines from my1.log
more content
more lines
00] my1.log 59KB - 2019/10/14 12:12:09
content lines from my2.log
more content
more lines
01] my2.log 120KB - 2019/10/14 14:22:29

Note that if you ask multitail to display non-text files or files you don't have permission to view, it will not complain. You just can’t see the content.

You can also use wildcards to specify the files to watch:

$ multitail my*.log

One thing to keep in mind is that multitail will split the screen evenly. If too many files are specified, you will only see the first few lines of the first seven files unless you take extra steps to view later files (see Scrolling Options below). The exact results depend on how many lines are available in the terminal window.

Press q to exit multitail and return to the normal screen view.

Split Screen

If you wish, multitail can also split your terminal window vertically (i.e., left and right). To do this, use the -s option. If three files are specified, the window on the right side of the screen will be split horizontally. With four files, you will have four windows of equal size.

+-----------+-----------+ +-----------+-----------+ +-----------+-----------+
| | | | | | | | |
| | | | | | | | |
| | | | +-----------+ +-----------+-----------+
| | | | | | | | |
| | | | | | | | |
+-----------+-----------+ +-----------+-----------+ +-----------+-----------+
2 files 3 files 4 files

If you want to split the screen into three columns, use multitail -s 3 file1 file2 file3.

+-------+-------+-------+
| | | |
| | | |
| | | |
| | | |
| | | |
+-------+-------+-------+
3 files with -s 3 option

scroll

You can scroll up and down through the files, but you need to press b to bring up the selection menu, then use the up and down arrow buttons to select the file you want to scroll through. Then press Enter. You can then use the up and down arrows again to scroll through the rows in the magnified area. When you are finished press q to return to normal view.

Get Help

Pressing h in multitail will open a help menu that describes some basic operations, but the man page provides more information and should be read carefully if you want to learn more about using this tool.

By default, multitail will not be installed on your system, but using apt-get or yum will allow you to install it easily. The tool provides many functions, but it is based on character display, and the window border is just a string of q and x. It comes in handy when you need to keep an eye on file updates.

Summarize

The above is the tutorial on using Multitail command on Linux introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

<<:  vue-cli configuration uses Vuex's full process record

>>:  Query process and optimization method of (JOIN/ORDER BY) statement in MySQL

Recommend

How to elegantly implement the mobile login and registration module in vue3

Table of contents Preface Input box component lay...

Zabbix monitoring docker application configuration

The application of containers is becoming more an...

How to install OpenSuse on virtualbox

The virtual machine is installed on the host mach...

Introduction to HTML method of opening link files using hyperlinks

a and href attributes HTML uses <a> to repr...

Javascript closure usage scenario principle detailed

Table of contents 1. Closure 2. Closure usage sce...

Optimize the storage efficiency of BLOB and TEXT columns in InnoDB tables

First, let's introduce a few key points about...

MySQL 8.0.16 installation and configuration graphic tutorial under macOS

This article shares the installation and configur...

Understanding of haslaylout and bfc parsing

1. haslayout and bfc are IE-specific and standard ...

How to use Xtrabackup to back up and restore MySQL

Table of contents 1. Backup 1.1 Fully prepared 1....

CentOS6.8 uses cmake to install MySQL5.7.18

Referring to the online information, I used cmake...

Several ways to switch between Vue Tab and cache pages

Table of contents 1. How to switch 2. Dynamically...

Simple example of using Docker container

Table of contents 1. Pull the image 2. Run the im...