Last Updated on May 22, 2022
In Operation
The main arguments to lnav are the files, directories, glob patterns, or URLs to be viewed. If no arguments are given, the default syslog file for your system is opened.
Here’s an image of lnav in operation.
The main part of the display shows the log lines from the files interleaved based on time-of-day. New lines are automatically loaded as they are appended to the files and, if you are viewing the bottom of the files, lnav scrolls down to show the new lines.
Errors and warnings are colored in red and yellow, respectively. Highlights are also applied to: SQL keywords, IP addresses, XML tags, file and line numbers in Java backtraces, and quoted strings.
Log file contents are merged into a single view based on message timestamps. This saves a lot of time when correlating timestamps across multiple windows.
One of the features that we frequently use is filtering. It lets you display only lines matching a specific pattern, filtering out the noise. Press colon and then, for example, enter filter-in gnome-shell to show only lines matching “gnome-shell”. Filters also apply to log lines as they are loaded.
An even more powerful feature is querying logs with SQL statements. This lets you perform queries on messages without loading the data into an SQL database. Instead, lnav using SQlite3’s virtual table feature. For all supported log file types, lnav creates tables that can be queried using the subset of SQL supported by Sqlite3. Environment variables can be used in SQL statements by prefixing the variable name with a dollar-sign. The query mode is accessed by pressing semicolon. SQL queries are checked for correctness as you type.
There’s also the ability to amalgamate data by time with the timeline view. This shows a histogram of messages over time. It’s accessed by pressing the i key. You can zoom in and out in this view.
Next page: Page 3 – Other Features
Pages in this article:
Page 1 – Introduction / Installation
Page 2 – In Operation
Page 3 – Other Features
Page 4 – Summary
Complete list of articles in this series:
Excellent Utilities | |
---|---|
AES Crypt | Encrypt files using the Advanced Encryption Standard |
Ananicy | Shell daemon created to manage processes’ IO and CPU priorities |
broot | Next gen tree explorer and customizable launcher |
Cerebro | Fast application launcher |
cheat.sh | Community driven unified cheat sheet |
CopyQ | Advanced clipboard manager |
croc | Securely transfer files and folders from the command-line |
Deskreen | Live streaming your desktop to a web browser |
duf | Disk usage utility with more polished presentation than the classic df |
eza | A turbo-charged alternative to the venerable ls command |
Extension Manager | Browse, install and manage GNOME Shell Extensions |
fd | Wonderful alternative to the venerable find |
fkill | Kill processes quick and easy |
fontpreview | Quickly search and preview fonts |
horcrux | File splitter with encryption and redundancy |
Kooha | Simple screen recorder |
KOReader | Document viewer for a wide variety of file formats |
Imagine | A simple yet effective image optimization tool |
LanguageTool | Style and grammar checker for 30+ languages |
Liquid Prompt | Adaptive prompt for Bash & Zsh |
lnav | Advanced log file viewer for the small-scale; great for troubleshooting |
lsd | Like exa, lsd is a turbo-charged alternative to ls |
Mark Text | Simple and elegant Markdown editor |
McFly | Navigate through your bash shell history |
mdless | Formatted and highlighted view of Markdown files |
navi | Interactive cheatsheet tool |
noti | Monitors a command or process and triggers a notification |
Nushell | Flexible cross-platform shell with a modern feel |
nvitop | GPU process management for NVIDIA graphics cards |
OCRmyPDF | Add OCR text layer to scanned PDFs |
Oh My Zsh | Framework to manage your Zsh configuration |
Paperwork | Designed to simplify the management of your paperwork |
pastel | Generate, analyze, convert and manipulate colors |
PDF Mix Tool | Perform common editing operations on PDF files |
peco | Simple interactive filtering tool that's remarkably useful |
ripgrep | Recursively search directories for a regex pattern |
Rnote | Sketch and take handwritten notes |
scrcpy | Display and control Android devices |
Sticky | Simulates the traditional “sticky note” style stationery on your desktop |
tldr | Simplified and community-driven man pages |
tmux | A terminal multiplexer that offers a massive boost to your workflow |
Tusk | An unofficial Evernote client with bags of potential |
Ulauncher | Sublime application launcher |
Watson | Track the time spent on projects |
Whoogle Search | Self-hosted and privacy-focused metasearch engine |
Zellij | Terminal workspace with batteries included |