Back to Turso

Command-Line Options

docs/sql-reference/cli/command-line-options.mdx

0.7.0-mikael3.7 KB
Original Source

Command-Line Options

bash
tursodb [OPTIONS] [DATABASE] [SQL]

Arguments

ArgumentDefaultDescription
DATABASE:memory:Path to a SQLite database file. If omitted, an in-memory database is created
SQLSQL statement to execute. If provided, the shell runs the query and exits

Examples

bash
# In-memory database
tursodb

# Open an existing file
tursodb customers.db

# Run a query and exit
tursodb customers.db "SELECT count(*) FROM orders;"

# Pipe SQL from stdin
echo "SELECT 1 + 1;" | tursodb -q

Options

-m, --output-mode <MODE>

Set the output display format.

ModeDescription
prettyTable with borders (default)
listPipe-delimited values
lineOne column per line with column names
bash
tursodb -m list mydata.db "SELECT * FROM users;"

-o, --output <PATH>

Redirect query output to a file instead of stdout.

bash
tursodb -o results.txt mydata.db "SELECT * FROM users;"

-q, --quiet

Suppress the startup banner and version information.

bash
tursodb -q mydata.db

-e, --echo

Print each SQL statement before executing it. Useful for debugging scripts.

bash
echo "SELECT 42;" | tursodb -q -e
SELECT 42;
42

-v, --vfs <VFS>

Select the Virtual File System backend.

VFSDescription
syscallStandard OS file I/O (default)
memoryIn-memory storage
io_uringLinux io_uring (requires feature flag)
bash
tursodb -v memory

-t, --tracing-output <PATH>

Write internal log traces to a file. Useful for debugging and performance analysis.

bash
tursodb -t trace.log mydata.db

--readonly

Open the database in read-only mode. Write operations will return an error.

bash
tursodb --readonly production.db "SELECT count(*) FROM users;"

Attempting to write in read-only mode:

bash
tursodb --readonly production.db "INSERT INTO users VALUES (1, 'test');"
# Error: Resource is read-only

--mcp

Start a Model Context Protocol server instead of the interactive shell. This allows AI assistants and other MCP clients to interact with the database via JSON-RPC.

bash
tursodb --mcp mydata.db

--sync-server <ADDRESS>

Start a sync server for database replication, listening at the given address.

bash
tursodb --sync-server 0.0.0.0:8080 mydata.db

Experimental Feature Flags

These flags enable features that are still under development. They may change or be removed in future releases.

<Warning> Experimental features may have incomplete implementations or known limitations. Use them for testing and development only. </Warning>
FlagDescription
--experimental-viewsEnable views (CREATE VIEW / DROP VIEW)
--experimental-custom-typesEnable custom types (CREATE TYPE / DROP TYPE)
--experimental-encryptionEnable at-rest database encryption
--experimental-index-methodEnable custom index methods. Necessary for FTS and Sparse Vector indexes
--experimental-autovacuumEnable automatic database vacuuming
--experimental-vacuumEnable in-place VACUUM
--experimental-triggersEnable triggers (CREATE TRIGGER / DROP TRIGGER)
--experimental-attachEnable ATTACH DATABASE / DETACH DATABASE
bash
# Enable views, triggers, and in-place VACUUM
tursodb --experimental-views --experimental-triggers --experimental-vacuum mydata.db

Other Flags

FlagDescription
--unsafe-testingEnable unsafe testing features (e.g., sqlite_dbpage writes)
-h, --helpPrint usage help
-V, --versionPrint version information