Master Real-Time Log Monitoring on Linux with tail, multitail, lnav, and less
This guide explains how to view and follow Linux log files in real time using tail (including -f, -F, and -n options), multitail for multiple logs, lnav as an alternative viewer, and less with Shift+F, plus installation commands for each tool.
How to view log files in real time on Linux using various utilities.
1. tail command – real‑time log monitoring
Use tail -f /var/log/apache2/access.log to follow a file. The tailf command is equivalent and does not require the -f switch. sudo tail -f /var/log/apache2/access.log When log rotation creates a new file, tail -F continues following the new file. 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 – monitor multiple logs simultaneously
Install multitail:
sudo apt install multitail # Debian/Ubuntu
sudo yum install multitail # RedHat/CentOS
sudo dnf install multitail # Fedora 22+Run it on two log files:
sudo multitail /var/log/apache2/access.log /var/log/apache2/error.log3. lnav – another multi‑log viewer
Install lnav:
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.log4. less – real‑time view with Shift+F
Press Shift+F inside less to follow the end of the file, similar to tail.
sudo less +F /var/log/apache2/access.logSigned-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.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
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.
