Skip to main content

Interactive Shell

Start an interactive LynxFlow REPL with tab completion, query history, and slash commands.

lynxdb shell [flags]

Aliases: sh, repl, console.

Flags

FlagShortDefaultDescription
--file-fFile mode (load file into ephemeral engine)
--since-s15mDefault time range for queries

Examples

# Connect to server
lynxdb shell

# Query a local file
lynxdb shell --file access.log

# Default time range
lynxdb shell --since 1h

Console Output

  LynxDB v0.1.0 — Interactive Shell
Connected to http://localhost:3100
Type /help for commands.

lynxdb> where level == "error" | stats count() by source
source count
nginx 340
api-gateway 120

2 rows — 45ms

lynxdb>

Slash Commands

Meta-operations available inside the shell:

CommandDescription
/help (/h)Show help
/quit (/exit, /q)Exit the shell
/clear (/cls)Clear the screen
/historyShow query history
/fieldsList known fields (server mode)
/sourcesList event sources (server mode)
/explain <query>Show query execution plan (server mode)
/set since <val>Change default time range
/since <duration>Shorthand for /set since <val>
/format <fmt>Set output format: table, json, csv, raw
/timing [on|off]Toggle elapsed time display
/serverShow server version, health, uptime (server mode)
/save <name> [query]Save last query or a specified query (server mode)
/run <name>Run a saved query by name (server mode)
/queriesList saved queries (server mode)
/tail <query>Start live tail with a LynxFlow filter (server mode)

Keyboard Shortcuts

KeyAction
EnterRun the query
Shift+EnterInsert a newline (multi-line input)
TabAccept inline suggestion / completion
Ctrl+SpaceOpen the completion popup
Up / Down, Ctrl+P / Ctrl+NNavigate query history
Ctrl+A / Ctrl+EJump to line start / end
Ctrl+LClear the results area
Ctrl+CCancel a running query / clear input (twice on empty input: exit)
Ctrl+DExit (on empty input)
EscClose popup / leave scroll mode (twice on idle prompt: exit)
PgUp / PgDn (or Option+↑ / Option+↓)Scroll results (enters scroll mode)
F2Toggle the sidebar

Scrolling Results

Press PgUp or PgDn to move focus from the prompt into the results area (scroll mode). On Mac keyboards without physical paging keys use Option+↑ / Option+↓ (or Fn+↑ / Fn+↓). Inside scroll mode the full set of Vim-style keys works:

KeyAction
j / k, arrow keysScroll line by line
u / d (also Ctrl+U)Half page up / down
b / f, PgUp / PgDn, Option+↑ / Option+↓, SpacePage up / down
g / G (also Home / End)Jump to top / bottom
y / YCopy last result table (plain / Markdown)
EscBack to the prompt

While in scroll mode the shell also captures the mouse, so the wheel scrolls the results and sidebar fields are clickable. At the prompt the mouse is left to the terminal for native text selection - note that in most terminals the wheel then sends arrow keys, which navigate query history instead.

The status bar at the bottom always shows the shortcuts available in the current mode.

Exiting

All of these leave the shell:

  • /quit (or /exit, /q)
  • Typing quit, exit, logout, q, :q, or \q (ClickHouse-style exit words)
  • Ctrl+D on an empty prompt
  • Pressing Ctrl+C or Esc twice on an empty prompt - the first press shows a hint, the second within 3 seconds exits

On exit the shell prints a short session summary (queries run, last result, elapsed time).

Tab Completion

The shell tab-completes:

  • LynxFlow stage names (stats, where, extend, sort, etc.)
  • Aggregation function names (count, avg, sum, p99, etc.)
  • Field names from the server's field catalog

Query History

  • Navigate previous queries with the up/down arrow keys
  • History is persisted to ~/.local/share/lynxdb/history
  • History survives between shell sessions

Multi-Line Input

Press Shift+Enter, or end a line with |, to continue on the next line:

lynxdb> where level == "error" |
...> stats count() by source |
...> sort -count |
...> head 10

File Mode

When started with --file, the shell loads the file into an ephemeral in-memory engine. All queries run locally without a server:

lynxdb shell --file /var/log/nginx/access.log
  LynxDB v0.1.0 — Interactive Shell
Loaded: /var/log/nginx/access.log (50,000 events)
Type /help for commands.

lynxdb> | stats count() by status
status count
200 45000
404 3000
500 2000

See Also