docs/sql-reference/cli/getting-started.mdx
The Turso CLI (tursodb) is an interactive SQL shell for working with Turso databases. It supports in-memory and file-based databases, multiple output modes, CSV import, database cloning, and built-in documentation.
Launch the shell with a transient in-memory database:
tursodb
tursodb mydata.db
Pass SQL as a command-line argument to run it and exit:
tursodb mydata.db "SELECT * FROM users;"
echo "SELECT sqlite_version();" | tursodb -q
When launched without a SQL argument, the shell provides an interactive REPL with command history and syntax highlighting.
Unfinished statements (missing semicolons, unbalanced parentheses) automatically continue on the next line. The prompt indicates nesting depth:
tursodb> SELECT *
...> FROM employees
...> WHERE department = 'Engineering';
Command history is saved automatically to ~/.limbo_history and accessible with up/down arrow keys.
Use .quit or .exit to leave the shell. Pressing Ctrl+C twice also exits.
Turso supports three output modes, selectable with the -m flag or the .mode dot command.
Human-readable table with borders:
tursodb -q -m pretty
┌────┬─────────┬─────────────┬─────────┐
│ id │ name │ department │ salary │
├────┼─────────┼─────────────┼─────────┤
│ 1 │ Alice │ Engineering │ 95000.0 │
├────┼─────────┼─────────────┼─────────┤
│ 2 │ Bob │ Marketing │ 72000.0 │
└────┴─────────┴─────────────┴─────────┘
Pipe-delimited values suitable for scripting:
tursodb -q -m list
1|Alice|Engineering|95000.0
2|Bob|Marketing|72000.0
One column per line, with column names:
tursodb -q -m line
id = 1
name = Alice
department = Engineering
salary = 95000.0
When input is piped (not a terminal), the shell runs in non-interactive mode:
list mode (override with -m)echo "SELECT 1 + 2;" | tursodb -q
The CLI can also run as a server instead of an interactive shell.
Start a Model Context Protocol server, allowing AI assistants to interact with the database:
tursodb --mcp mydata.db
Start a sync server for database replication:
tursodb --sync-server 0.0.0.0:8080 mydata.db