Operations 5 min read

Master Real-Time Log Monitoring on Linux with Tail, Multitail, Lnav & Less

This guide explains how to monitor Linux log files in real time using commands such as tail (with -f, -F, and -n options), tailf, multitail, lnav, and less, including installation steps and example usages for Apache logs.

Efficient Ops
Efficient Ops
Efficient Ops
Master Real-Time Log Monitoring on Linux with Tail, Multitail, Lnav & Less

On Linux, you can view log files in real time using several tools; the most common is the tail command.

1. tail Command – Monitor Logs in Real Time

The tail command is the most common way to view log files as they grow. Use the -f option to follow a file:

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

Alternatively, the tailf command has -f built‑in, so you can run:

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

When logs are rotated, use -F to follow the name even if the underlying file descriptor changes: $ 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 – Monitor Multiple Log Files in Real Time

Install Multitail on Debian/Ubuntu, RedHat/CentOS, or Fedora:

$ sudo apt install multitail   [On Debian & Ubuntu]
$ sudo yum install multitail   [On RedHat & CentOS]
$ sudo dnf install multitail   [On Fedora 22+]

Example to view two logs simultaneously:

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

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

Install lnav similarly:

$ sudo apt install lnav   [On Debian & Ubuntu]
$ sudo yum install lnav   [On RedHat & CentOS]
$ sudo dnf install lnav   [On Fedora 22+]

View two logs with lnav:

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

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

Open a log with less and press Shift+F to follow the end of the file, similar to tail -f. You can also start less with the +F option:

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

linuxLog Monitoringlesstailmultitaillnav
Efficient Ops
Written by

Efficient Ops

This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.

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.