docs/sql-reference/cli/shell-commands.mdx
Dot commands are special commands available in the interactive shell. They start with a period (.) and do not require a trailing semicolon.
tursodb> .help
Open a database file, optionally specifying a VFS backend.
.open <PATH> [VFS]
tursodb> .open mydata.db
tursodb> .open mydata.db memory
Exit the shell. Aliases: .q, .qu, .qui.
tursodb> .quit
Exit the shell with an optional return code. Aliases: .ex, .exi.
.exit [CODE]
tursodb> .exit
tursodb> .exit 1
Change the current working directory.
.cd <DIRECTORY>
tursodb> .cd /tmp
List all tables in the database, optionally filtered by a pattern.
.tables [PATTERN]
CREATE TABLE employees (id INTEGER PRIMARY KEY, name TEXT);
CREATE TABLE departments (id INTEGER PRIMARY KEY, name TEXT);
tursodb> .tables
employees
departments
tursodb> .tables emp%
employees
Display the CREATE statement for a table, or all tables if no argument is given.
.schema [TABLE]
tursodb> .schema employees
CREATE TABLE employees (id INTEGER PRIMARY KEY, name TEXT);
tursodb> .schema
CREATE TABLE employees (id INTEGER PRIMARY KEY, name TEXT);
CREATE TABLE departments (id INTEGER PRIMARY KEY, name TEXT);
Show index names, optionally filtered by table.
.indexes [TABLE]
CREATE TABLE employees (id INTEGER PRIMARY KEY, name TEXT, department TEXT);
CREATE INDEX idx_dept ON employees(department);
CREATE INDEX idx_name ON employees(name);
tursodb> .indexes
idx_dept
idx_name
tursodb> .indexes employees
idx_dept
idx_name
List all attached databases.
tursodb> .databases
main: /path/to/mydata.db r/w
Set the output display mode.
.mode <MODE>
| Mode | Description |
|---|---|
pretty | Table with borders (default) |
list | Pipe-delimited values |
line | One column per line with column names |
tursodb> .mode list
tursodb> SELECT 1 AS a, 2 AS b;
1|2
tursodb> .mode line
tursodb> SELECT 1 AS a, 2 AS b;
a = 1
b = 2
tursodb> .mode pretty
tursodb> SELECT 1 AS a, 2 AS b;
┌───┬───┐
│ a │ b │
├───┼───┤
│ 1 │ 2 │
└───┴───┘
Toggle column headers on or off in list mode.
.headers <on|off>
tursodb> .mode list
tursodb> .headers on
tursodb> SELECT 1 AS x, 2 AS y;
x|y
1|2
tursodb> .headers off
tursodb> SELECT 1 AS x, 2 AS y;
1|2
Set the string displayed for NULL values in list mode.
.nullvalue <STRING>
tursodb> .mode list
tursodb> .nullvalue [NULL]
tursodb> SELECT 1 AS a, NULL AS b;
1|[NULL]
Redirect query output to a file. Call with no argument or stdout to restore output to the terminal.
.output [PATH]
tursodb> .output results.txt
tursodb> SELECT * FROM employees;
tursodb> .output
tursodb> -- Output is back to the terminal
Toggle echo mode. When on, each SQL statement is printed before execution.
.echo <on|off>
tursodb> .echo on
tursodb> SELECT 42;
SELECT 42;
┌────┐
│ 42 │
├────┤
│ 42 │
└────┘
Display current shell settings.
tursodb> .show
Settings:
Output mode: pretty
DB: mydata.db
Output: STDOUT
Null value:
CWD: /home/user
Echo: off
Headers: off
Toggle query timing. When on, shows execution time and I/O statistics after each query.
.timer <on|off>
tursodb> .timer on
tursodb> SELECT 42;
42
Command stats:
----------------------------
total: 442 us (this includes parsing/coloring of cli app)
query execution stats:
----------------------------
Execution: avg=4 us, total=8 us
I/O: No samples available
Display database statistics. Use on/off to toggle automatic display after every query, or --reset to clear counters.
.stats [on|off] [--reset]
tursodb> .stats
Connection Metrics:
Total statements: 3
High-water marks:
Max VM steps: 19
Max rows read: 1
Aggregate Statistics:
Statement Metrics:
Row Operations:
Rows read: 1
Rows written: 2
Execution:
VM steps: 48
Instructions: 47
...
Show VDBE (Virtual Database Engine) opcodes with descriptions. Optionally filter by opcode name.
.opcodes [OPCODE]
tursodb> .opcodes Integer
Integer
-------
The 64-bit integer value P1 is written into register P2. This is different
from SQLite, where this opcode is used for 32-bit integers
List available Virtual File System modules.
tursodb> .vfslist
Available VFS modules:
memory
syscall
Output the entire database as SQL statements that can recreate it.
tursodb> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE employees (id INTEGER PRIMARY KEY, name TEXT);
INSERT INTO "employees" VALUES(1,'Alice');
INSERT INTO "employees" VALUES(2,'Bob');
COMMIT;
tursodb original.db ".dump" | tursodb -q clone.db
Import data from a file into a table.
.import [--csv] [--skip N] [--verbose] <FILE> <TABLE>
| Option | Default | Description |
|---|---|---|
--csv | on | Use comma as field separator and newline as record separator |
--skip N | 0 | Skip the first N rows (useful for skipping a header row) |
--verbose | off | Print progress information during import |
tursodb> CREATE TABLE people (name TEXT, age INTEGER);
tursodb> .import --csv --skip 1 data.csv people
tursodb> SELECT * FROM people;
┌─────────┬─────┐
│ name │ age │
├─────────┼─────┤
│ Alice │ 30 │
├─────────┼─────┤
│ Bob │ 25 │
├─────────┼─────┤
│ Charlie │ 35 │
└─────────┴─────┘
Given a CSV file data.csv:
name,age
Alice,30
Bob,25
Charlie,35
Clone the current database to a new file.
.clone <OUTPUT_FILE>
tursodb> .clone backup.db
employees... done
Execute SQL statements from a file.
.read <PATH>
tursodb> .read setup.sql
Load an extension library.
.load <PATH>
tursodb> .load ./liblimbo_regexp
Display raw database page contents in hex format. Useful for debugging storage-level issues.
.dbtotxt [--page PAGE_NO]
tursodb> .dbtotxt --page 1
| size 8192 pagesize 4096 filename :memory:
| page 1 offset 0
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
| 16: 10 00 02 02 00 40 20 20 00 00 00 01 00 00 00 02 .....@ ........
...
Print or set database configuration flags. Currently a no-op in Turso.
.dbconfig [CONFIG] [on|off]
Display built-in manual pages for Turso features. Call with no argument to list all available manuals.
.manual [PAGE]
Aliases: .man.
tursodb> .manual
# Turso Manual Pages
Available manuals:
custom-types Custom Types for STRICT Tables
cdc Change Data Capture
encryption At-Rest Database Encryption
vector Vector Search
materialized-views Live Materialized Views
mcp Model Context Protocol server
tursodb> .manual vector