Use sqlite3 for a quick local database

Store and query structured data in a single file with SQLite — no server, no setup.

Linuxsqlite3sqlclidatabaseLow risk
Run sqlite3 data.db followed by SQL in quotes — the file is created on first use, and .tables / .schema / .mode column help you explore it.

01Command

Command
$ sqlite3 data.db "CREATE TABLE t (id INTEGER PRIMARY KEY, name TEXT); INSERT INTO t (name) VALUES ('alice'); SELECT * FROM t;"

02What it does

SQLite keeps an entire database in one ordinary file, so it is ideal for app data, exports and quick analysis on any machine. Running sqlite3 data.db opens (or creates) the file and drops you into a shell where standard SQL works; dot-commands like .mode column, .headers on, .tables and .schema make the output readable. Backup is just copying the file (or .backup data.db.bak while the shell is open), and it ships with Python, browsers and phones everywhere.

03Risk

RiskLow risk
Requirementssqlite3 CLI installed (most distros include it).
!Warning: SQLite locks the whole file during writes — don't point a network share at it or expect heavy concurrent writers. Exit with .quit; dot-commands have no semicolon, SQL statements need one. Deleting the .db file deletes the database.

04Undo

Undo
$ rm data.db

05Sources

Last verified: 2026-09-18 · Category: Developer