The DuckDB CLI can be configured using command-line options when starting the CLI, or by using dot commands within an interactive session.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/duckdb/duckdb/llms.txt
Use this file to discover all available pages before exploring further.
Command-Line Options
Options can be specified when starting the DuckDB CLI:Output Mode Options
Set the output format for query results:-ascii- Set output mode to ‘ascii’ (uses ASCII unit and record separators)-box- Set output mode to ‘box’ (Unicode box-drawing characters)-column- Set output mode to ‘column’ (columnar output)-csv- Set output mode to ‘csv’ (comma-separated values)-html- Set output mode to ‘html’ (HTML table format)-json- Set output mode to ‘json’ (JSON array)-jsonlines- Set output mode to ‘jsonlines’ (newline-delimited JSON)-line- Set output mode to ‘line’ (one column per line)-list- Set output mode to ‘list’ (values delimited by|)-markdown- Set output mode to ‘markdown’ (Markdown table format)-quote- Set output mode to ‘quote’ (SQL-style quoting)-table- Set output mode to ‘table’ (ASCII table)
Execution Options
-c COMMAND- Run the SQL command and exit-cmd COMMAND- Run the SQL command before reading stdin-s COMMAND- Run the SQL command and exit (same as-c)-f FILENAME- Read and process SQL commands from file and exit
Input/Output Options
-echo- Print commands before execution-header- Turn headers on-noheader- Turn headers off-interactive- Force interactive I/O-batch- Force batch I/O (non-interactive mode)-no-stdin- Exit after processing options instead of reading stdin
Initialization Options
-init FILENAME- Read initialization commands from the specified file
~/.duckdbrc on startup. Use -init to specify a different file:
Database Options
-readonly- Open the database in read-only mode-safe- Enable safe mode (disables external access)-unsigned- Allow loading of unsigned extensions-unredacted- Allow printing of unredacted secrets
Separator Options
-separator SEP- Set output column separator (default:|)-newline SEP- Set output row separator (default:\n)-nullvalue TEXT- Set text string for NULL values (default:NULL)
Other Options
-bail- Stop after hitting an error-version- Show DuckDB version and exit-hor-help- Show help message and exit-ui- Launch web interface using the UI extension
Output Formats
The CLI supports multiple output formats, configurable with the-mode option or .mode command.
Default (duckbox)
Unicode box-drawing with extensive formatting features:CSV
Comma-separated values:JSON
JSON array format:JSON Lines
Newline-delimited JSON:Markdown
Markdown table format:List
Pipe-delimited values:Line
One value per line:Storage Version
Set the database storage compatibility version:Configuration File
DuckDB automatically reads~/.duckdbrc on startup. This file can contain:
- Dot commands (e.g.,
.mode,.headers) - SQL statements
- Configuration settings
~/.duckdbrc:
Environment Variables
The CLI respects these environment variables:DUCKDB_PAGER- Pager command to use (overridesPAGER)PAGER- Default pager command (e.g.,less,more)EDITORorVISUAL- Text editor for.editcommandDUCKDB_EDITOR- DuckDB-specific editor (overridesEDITORandVISUAL)