Operations 5 min read

How to Monitor Linux Logs in Real Time with Tail, Multitail, Lnav, and Less

This guide explains how to use Linux command‑line tools such as tail, tailf, tail ‑F, multitail, lnav, and less to continuously watch log files, covering installation, key options, and practical examples for single‑ and multi‑file monitoring.

ITPUB
ITPUB
ITPUB
How to Monitor Linux Logs in Real Time with Tail, Multitail, Lnav, and Less

1. tail Command – Monitor Logs in Real Time

The most common way to follow a growing log file is the tail command. It has two variants: tail -f /var/log/apache2/access.log follows the file using the -f flag. tailf /var/log/apache2/access.log is a built‑in version that implicitly includes -f.

When logs are rotated, use -F so that tail switches to the newly created file: sudo tail -F /var/log/apache2/access.log If you only need the last few lines while following, combine -n with -f:

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

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

Multitail can display several logs side by side and lets you scroll back through each file.

Installation commands:

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

Example to watch both access and error logs simultaneously:

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

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

Lnav provides similar multi‑file monitoring with a built‑in viewer.

Install it with:

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

To open two logs at once:

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

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

The less pager can also follow a file. Press Shift+F inside less, or start it with +F:

sudo less +F /var/log/apache2/access.log
less example
less example
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.

Linuxcommand-lineLog Monitoringlesstailmultitaillnav
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

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.