Skip to main content

CLI Overview

LynxDB ships as a single binary. The same executable provides:

  • ad hoc analytics on local files and stdin
  • a persistent server
  • a Web UI launcher
  • administrative commands for auth, status, cache, config, jobs, and views
lynxdb [command] [flags]

Modes of Operation

The CLI changes behavior depending on the command and on whether stdin is piped.

Server mode

lynxdb server

Starts the HTTP server. Commands such as query, ingest, status, fields, jobs, and mv then talk to that server over HTTP.

Local file mode

lynxdb query --file access.log '| stats count() by status'

Queries files directly without a running server. LynxDB creates an ephemeral in-memory engine, ingests the matching file set, runs the query, prints results, and exits.

Stdin pipe mode

cat app.log | lynxdb query '| stats count() by level'

This is the same ephemeral execution path as file mode, but the input comes from stdin.

Bare stdin mode

If stdin is piped and you run lynxdb with no subcommand, LynxDB defaults to a preview query:

cat app.log | lynxdb

That runs the equivalent of | head 10 after format detection.

If stdin is piped and the first argument is not a known subcommand, LynxDB treats the remaining arguments as a query:

cat app.log | lynxdb 'where level == "error" | stats count() by source'

Global Flags

Available on all commands:

FlagShortDefaultEnv VarDescription
--config(auto)Path to config file
--serverhttp://localhost:3100LYNXDB_SERVERLynxDB server address
--tokenLYNXDB_TOKENAPI key for authentication
--profile-pLYNXDB_PROFILEConnection profile name
--format-FautoOutput format: auto, json, ndjson, table, box, ascii, markdown, vertical, line, G, csv, tsv, raw
--quiet-qfalseSuppress non-data output
--verbose-vfalseShow extra detail
--no-statsfalseSuppress query statistics
--no-colorfalseDisable colored output
--themeautoHuman output theme: auto, dark, light, plain
--compactfalseUse compact human output
--max-rows0Maximum rows to show in human table output (0 = all)
--max-width0Maximum width for human table output (0 = terminal width)
--null-valuePlaceholder for null or empty values in human table output
--debugfalseEnable debug logging to stderr
--tls-skip-verifyfalseLYNXDB_TLS_SKIP_VERIFYSkip TLS certificate verification

Output Mode

With --format auto, LynxDB chooses a human-friendly format for interactive terminals and a machine-friendly format when stdout is piped. Use --format to force a stable format for scripts.

# Stable JSON for scripts
lynxdb query 'from main level=error | stats count() by source' --format json

# Stable CSV export
lynxdb query 'from main level=error | stats count() by source' --format csv

# Human-readable table output
lynxdb query 'from main level=error | stats count() by source' --format table

# Vertical output for wide rows
lynxdb query 'from main level=error | head 2' --format vertical

NO_COLOR disables colored output when set. --format line and --format G are aliases for vertical output; the query suffix \G also switches auto format to vertical output.

Exit Codes

The root command advertises these exit codes:

CodeMeaning
0Success
1General error
2Usage error
3Connection error
4Query parse error
5Query timeout
6No results (--fail-on-empty)
7Authentication error
10Aborted by user
130Interrupted

Command Map

Some commands have dedicated reference pages in this documentation set. Others are currently discoverable via lynxdb <command> --help.

CategoryCommands
Querying and ingestquery, ingest, import, tail, fields, count, sample, watch, diff, last, explain, examples
Server and operationsserver, status, health, indexes, cache, jobs, doctor, shippers
Saved objectsmv, saved, save, run
Authentication and connectionlogin, logout, auth, config
Interactive and UIshell, ui, open, share, top
Setup and maintenanceinit, install, uninstall, upgrade, version, completion, admin format-upgrade
Diagnostics and miscbench, demo, grammar, explain-error, sigma

Migration Hints

LynxFlow v2 replaced the legacy SPL2 language. When a query uses a removed SPL2 stage, the parser rejects it with a targeted error and a suggestion for the v2 equivalent:

error[E011] at 1:3: eval is renamed to extend in v2
| eval is_slow = duration_ms > 1000
^~~~
suggestion: extend

Run lynxdb examples for a built-in query cookbook.