Operations 5 min read

Master Real-Time Log Monitoring on Linux with tail, multitail, lnav & less

This guide explains how to use Linux commands such as tail, tailf, tail -F, multitail, lnav, and less to monitor log files in real time, covering installation, key options, and practical examples for single and multiple log streams.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Real-Time Log Monitoring on Linux with tail, multitail, lnav & less

1. tail Command – Monitor Logs in Real Time

The tail utility is the most common way to watch a growing log file. Use the -f flag to follow a file: $ sudo tail -f /var/log/apache2/access.log The built‑in tailf command behaves the same way without needing -f: $ sudo tailf /var/log/apache2/access.log When logs are rotated, use -F so tail follows the new file descriptor: $ sudo tail -F /var/log/apache2/access.log To display only the last two lines while following, combine -n and -f:

$ sudo tail -n2 -f /var/log/apache2/access.log

2. Multitail Command – Watch Multiple Logs Simultaneously

Multitail can monitor several log files at once and lets you scroll back within each stream.

Installation:

$ sudo apt install multitail   # Debian/Ubuntu
$ sudo yum install multitail   # RedHat/CentOS
$ sudo dnf install multitail   # Fedora 22+

Example – display both access and error logs together:

$ sudo multitail /var/log/apache2/access.log /var/log/apache2/error.log

3. lnav Command – Another Multi‑Log Viewer

lnav offers similar multi‑file monitoring with a richer interactive interface.

Installation:

$ sudo apt install lnav   # Debian/Ubuntu
$ sudo yum install lnav   # RedHat/CentOS
$ sudo dnf install lnav   # Fedora 22+

Run lnav on two logs:

$ sudo lnav /var/log/apache2/access.log /var/log/apache2/error.log

4. less Command – Real‑Time View with Shift+F

The classic pager less can also follow a file. Press Shift+F after opening, or start it with +F: $ sudo less +F /var/log/apache2/access.log Like tail, less will keep displaying new lines as the file grows.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Log Monitoringlesstailmultitaillnav
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.