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.

Spatial Navigation

The majority of these hotkeys should be available in all views.

Keypress

Command

Space

PgDn

Down a page

Ctrl + d

Down by half a page

b

Backspace

PgUp

Up a page

Shift + b

Move to the first line of a multi-line log message. If the currently focused line is the first, move up by a tenth of the content height.

Ctrl + u

Up by half a page

j

Down a line

k

Up a line

h

Left half a page. In the log view, pressing left while at the start of the message text will reveal the shortened source file name for each line. Pressing again will reveal the full path.

Shift + h

Shift +

Left ten columns

l

Right half a page. In the log view, pressing right while at the start of the message text can hide the timestamp/level fields in the message and insert a shorter timestamp column on the left side. The column should take less space than the existing field and aligns all timestamps across all log formats. This feature is gated by the /ui/views/log/time-column setting.

Shift + l

Shift +

Right ten columns

Home

g

Top of the view

End

G

Bottom of the view

e

Shift + e

Next/previous error

w

Shift + w

Next/previous warning

n

Shift + n

Next/previous search hit

>

<

Next/previous search hit (horizontal)

f

Shift + f

Next/previous file

u

Shift + u

Next/previous bookmark

o

Shift + o

Forward/backward through log messages with a matching “opid” field

s

Shift + s

Next/previous slow down in the log message rate

{

}

Previous/next section in the view. For the LOG view, if the cursor is in the middle of a multi-line log message, this will move to the start of the message or the next message. Otherwise, it will move to the adjacent partition. For the TEXT view, the following document types have recognizable sections: JSON, man, diff, and Markdown.

F7

F8

Previous/next breakpoint

CTRL + b

Toggle a breakpoint for the focused log line

Chronological Navigation

These hotkeys are only functional on views that are time-based, like the log view or the histogram view.

Keypress

Command

d

Shift + d

Forward/backward 24 hours

1 - 6

Shift + 1 - 6

Next/previous n’th ten minute of the hour

7

8

Previous/next minute

0

Shift + 0

Next/previous day

r

Shift + r

Forward/backward by the relative time that was last used with the goto command.

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 :sh command.

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 saved-prompt and, if available, open the file in the configured external editor

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.