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 | take 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 '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, csv, tsv, raw
--quiet-qfalseSuppress non-data output
--verbose-vfalseShow extra detail
--no-statsfalseSuppress query statistics
--no-colorfalseDisable colored 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 'level=error | stats count by source' --format json

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

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

NO_COLOR disables colored output when set.

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
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
Diagnostics and miscbench, demo, grammar, explain-error

SPL Compatibility Hints

When using file or stdin query mode, LynxDB detects several common Splunk-style patterns and prints compatibility hints to stderr.

Example:

hint: "index=main" is Splunk SPL syntax. In LynxDB SPL2, use "FROM main" instead.

Run lynxdb examples for a built-in query cookbook.