Use sqlite3 for a quick local database
Store and query structured data in a single file with SQLite — no server, no setup.
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
!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.db05Sources
- sqlite3(1) - a command line interface for SQLiteEvidence: sqlite3 [options] [databasefile] [SQL] runs SQL against a single-file database; dot-commands like .tables, .schema and .mode column control output.
- Command Line Shell For SQLite — official docsEvidence: Documents the CLI, dot-commands, .mode, .backup and the fact that the database is a single regular file created on first use.
Last verified: 2026-09-18 · Category: Developer