Master Real-Time Log Monitoring on Linux: tail, multitail, lnav & less
This guide explains how to use Linux commands such as tail, tail‑f, tail ‑F, multitail, lnav and less to monitor log files in real time, covering installation, usage examples, and options for handling rotated logs and selective line output.
In Linux, several commands enable real‑time monitoring of log files.
1. tail Command – Monitor Logs in Real Time
The most common way is using tail with the -f option: $ 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 the -F option to follow a newly created file with the same name: $ 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.log2. 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+]Run it to view two logs simultaneously:
$ sudo multitail /var/log/apache2/access.log /var/log/apache2/error.log3. 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+]Start lnav with multiple files:
$ sudo lnav /var/log/apache2/access.log /var/log/apache2/error.log4. less Command – Display Real‑Time Output of Log Files
You can use less and press Shift+F to follow a file, similar to tail -f. The same effect can be achieved by launching less with the +F option: sudo less +F /var/log/apache2/access.log These commands provide flexible ways to watch logs as they grow, handle log rotation, and monitor multiple files at once.
Manage Files Effectively using head, tail and cat Commands in Linux
How to Setup and Manage Log Rotation Using Logrotate in Linux
Petiti – An Open Source Log Analysis Tool for Linux SysAdmins
How to Query Audit Logs Using ‘ausearch’ Tool on CentOS/RHEL
Manage Log Messages Under Systemd Using Journalctl {Comprehensive Guide}
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
