Install lnav Log File Viewer on Ubuntu 24.04

Install lnav Log File Viewer on Ubuntu 24.04

Efficient log management is crucial for system administrators and developers when diagnosing system issues or monitoring application performance. Log File Navigator (lnav) is a terminal-based log viewer that simplifies log analysis by combining multiple log files, highlighting errors, and providing useful visualizations. This tutorial shows how to install lnav log file viewer on Ubuntu 24.04.

Install lnav

Check the most recent lnav version from its GitHub repository and assign version to variable:

LNAV_VERSION=$(curl -s "https://api.github.com/repos/tstack/lnav/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')

Download lnav with the version identified earlier:

wget -qO lnav.zip https://github.com/tstack/lnav/releases/latest/download/lnav-$LNAV_VERSION-linux-musl-x86_64.zip

Extract executable to /usr/local/bin directory:

sudo unzip -jq lnav.zip -d /usr/local/bin lnav-$LNAV_VERSION/lnav

Verify the installation by checking the lnav version:

lnav --version

The archive file is no longer required, you can safely delete it:

rm -rf lnav.zip

Testing lnav

Run the lnav command by specifying log file as argument:

lnav /var/log/dpkg.log
View log file using lnav on Ubuntu

Uninstall lnav

To remove lnav, delete its executable file:

sudo rm -rf /usr/local/bin/lnav

You can also remove configuration files:

rm -rf ~/.config/lnav

Leave a Comment

Cancel reply

Your email address will not be published.