Operations 5 min read

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

Learn how to monitor Linux log files in real time using essential command‑line tools such as tail (with -f, -F, and -n options), multitail, lnav, and less, including installation commands and practical examples for single and multiple log streams.

Programmer DD
Programmer DD
Programmer DD
Master Real-Time Log Monitoring on Linux: tail, multitail, lnav & less

1. tail Command – Monitor Logs in Real Time

As mentioned, the tail command is the most common way to display logs in real time. It has two variants:

tail -f

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

tailf

sudo tailf /var/log/apache2/access.log

For rotated logs use -F which follows the file name even when the underlying file descriptor changes: sudo tail -F /var/log/apache2/access.log To show only the last two lines while following, combine -n and -f:

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

2. Multitail Command – Monitor Multiple Log Files in Real Time

Multitail can display several logs simultaneously and lets you scroll back.

Install:

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

Example showing two logs:

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

3. lnav Command – Monitor Multiple Log Files in Real Time

lnav is another tool for real‑time multi‑file monitoring.

Install:

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

View two logs together:

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

4. less Command – Display Real‑Time Output of Log Files

You can also use less and press Shift+F to follow a file, or start it with +F: sudo less +F /var/log/apache2/access.log How do you monitor log files? Share your method in the comments.

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.

LinuxSysadminLog Monitoringlesstailmultitaillnav
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

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.