sqlite3
CLICommand-line shell for SQLite databases. Preinstalled on macOS; apt install sqlite3 on Linux.
Query a .db/.sqlite file non-interactively with SQL or dot-commands
Verified commands
Executed by our harness on the platforms shown; the assertion checked the actual result, not just the exit code.
List tables
sqlite3 app.db '.tables'Show a table's schema
sqlite3 app.db '.schema users'Run a query with column headers
sqlite3 -header -column app.db 'SELECT * FROM users LIMIT 5'Run a query and get JSON
sqlite3 -json app.db 'SELECT id, name FROM users WHERE active = 1'Import a CSV (with header row) into an existing table
sqlite3 app.db '.import --csv --skip 1 users.csv users'Common failures (1)
- header row inserted as dataadd --skip 1 when the table already exists; omit it only when letting .import create the table
Install
Homebrew
brew install sqliteapt
sudo apt install sqlite3Agent notes
- When to use
- Inspecting an app's local database, checking migrations, loading CSV fixtures
- Quick examples
sqlite3 app.db '.tables'sqlite3 -json app.db 'SELECT * FROM users'
Use from an agent
curl -s https://clihub.com/api/tools/sqlite3 | jq '.agentHints.provenRecipes[] | {task, command, verified}'Or call get_tool with slug sqlite3 on the MCP server at https://clihub.com/mcp.