Hotkey Reference¶
This reference covers the keys used to control lnav. Consult the built-in help in lnav for a more detailed explanation of each key.
Global¶
Keypress |
Command |
|---|---|
Ctrl + C |
If the focused line is from a file connected to an open pipe (the “↻” icon will be next to the file name), a SIGINT will be sent to the child process. Otherwise, lnav will quickly exit. If lnav seems to be stuck in a loop, pressing Ctrl + C three times will trigger an abort exit. |
Bookmarks¶
Keypress |
Command |
|---|---|
m |
Mark/unmark the top line or focused line when in cursor mode |
Shift + m |
Mark/unmark the range of lines from the last marked to the top |
Shift + j |
Mark/unmark the next line after the previously marked |
Shift + k |
Mark/unmark the previous line |
c |
Copy marked lines to the clipboard |
Shift + c |
Clear marked lines |
Ctrl + s |
Toggle a sticky header for the focused line. Sticky headers remain visible at the top of the view as you scroll past them. |
Display¶
Keypress |
Command |
|---|---|
? or F1 |
View/leave builtin help |
q |
Return to the previous view/quit |
Shift + q |
Return to the previous view/quit while matching the top times of the two views |
a |
Restore the view that was previously popped with ‘q/Q’ |
Shift + a |
Restore the view that was previously popped with ‘q/Q’ and match the top times of the views |
Shift + p |
Switch to/from the pretty-printed view of the displayed log or text files |
Shift + t |
Display the elapsed time from a bookmark to a given line. In the TEXT view,
this only works for content that was captured from stdin or a |
t |
Switch to/from the text file view |
i |
Switch to/from the histogram view |
Shift + i |
Switch to/from the histogram view while keeping the time of the focused line in sync |
z |
Zoom in to finer-grained times in the HIST or SPECTRO views. |
Shift + Z |
Zoom out to larger-grained times in the HIST or SPECTRO views. |
v |
Switch to/from the SQL result view |
Shift + v |
Switch to/from the SQL result view and move to the corresponding in the log_line column |
p |
Toggle the display of the log parser results |
Tab |
In the log/text views, focus on the configuration panel for editing filters and examining the list of loaded files. |
Ctrl + l |
Switch to lo-fi mode. The displayed log lines will be dumped to the terminal without any decorations so they can be copied easily. |
Ctrl + w |
Toggle word-wrap. |
Ctrl + p |
Show/hide the data preview panel that may be opened when entering commands or SQL queries. |
Ctrl + f |
Toggle the enabled/disabled state of all filters in the current view. |
x |
Toggle the hiding of log message fields. The hidden fields will be replaced with three bullets and highlighted in yellow. |
Ctrl + x |
Toggle the cursor mode. Allows moving the focused line instead of keeping it fixed at the top of the current screen. |
= |
Pause/unpause loading of new file data. |
X |
Close the current text file or log file. |
F2 |
Toggle mouse support. |
Session¶
Keypress |
Command |
|---|---|
Ctrl + R |
Reset the current session state. The session state includes things like filters, bookmarks, and hidden fields. |
Query Prompts¶
Keypress |
Command |
|---|---|
/ |
Search for lines matching a regular expression |
; |
Open the SQLite Interface to execute SQL statements/queries |
: |
Execute an internal command, see Commands for more information |
| |
Execute an lnav script located in a format directory |
Ctrl + ] |
Abort the prompt |
Prompt¶
After activating the prompt, the following shortcuts are available for editing:
Keypress |
Command |
|
|---|---|---|
Escape |
Depending on the mode: close the completion popup; exit search mode; cancel the prompt |
|
Enter |
In single line mode, exit the prompt and perform the operation. In multi-line mode, insert a new line. |
|
Ctrl + X |
Exit the prompt and perform the operation |
|
F1 |
Open the help text for the prompt |
|
← |
Move left one character |
|
→ |
Move right one character |
|
Shift + ← |
Move left one character and include it in the selection |
|
Shift + → |
Move right one character and include it in the selection |
|
↑ |
Ctrl + P |
In single-line mode, search the history with the current contents. In multi-line mode, move the cursor up a line. If a popup is open, move the selection up. |
↓ |
Ctrl + N |
In multi-line mode, move the cursor down a line. If a popup is open, move the selection down. |
Ctrl + A |
Move to the beginning of the line |
|
Ctrl + E |
Move to the end of the line |
|
Ctrl + K |
Cut to the end of the line into the clipboard |
|
Ctrl + U |
Cut from the beginning of the line to the cursor into the clipboard |
|
Ctrl + W |
Cut from the beginning of the previous word into the clipboard |
|
Ctrl + Y |
Paste the clipboard contents |
|
Tab |
Enter |
Accept a completion suggestion |
Ctrl + _ |
Undo a change |
|
Ctrl + L |
In the SQL prompt, reformat the contents of the prompt and switch to multi-line mode |
|
Ctrl + O |
Save the contents of the prompt in a script file named
|
|
Ctrl + S |
In multi-line mode, switch to search mode. If already in search mode, find the next occurrence. |
|
Ctrl + R |
In search mode, search for the previous occurrence. Otherwise, search history using current contents of the prompt |
Customizing¶
New hotkeys can be defined and existing behaviors changed by updating lnav’s configuration. Since most of lnav’s functionality is exposed through SQLite functions and SQLite virtual tables, quite a lot is possible. For example, if you regularly want to find a log message with a particular pattern, like “Starting execution”. The following command will find the next occurrence after the currently focused message:
;SELECT log_line FROM all_logs WHERE log_line > log_msg_line() AND log_body LIKE '%Starting execution%' LIMIT 1
To then move the focus in the log view to the line found by the above command, you can run the following:
;UPDATE lnav_views SET selection = (SELECT log_line FROM all_logs WHERE log_line > log_msg_line() AND log_body LIKE '%Starting execution%' LIMIT 1) WHERE name = 'log'
To bind that command to a key, like F9, you can run the following
:config command:
:config /ui/keymap-defs/default/f9/command ;UPDATE lnav_views SET selection = (SELECT log_line FROM all_logs WHERE log_line > log_msg_line() AND log_body LIKE '%Starting execution%' LIMIT 1) WHERE name = 'log'
Consult the Keymaps configuration section for more information.