SQLite: Meta Commands Cheat Sheet

.backup ?DB? FILEBackup DB (default “­mai­n”) to FILE
.bail ON|OFFStop after hitting an error. Default OFF
.databasesList names and files of attached databases
.dump ?TABLE? ...Dump the database in an SQL text format.
.echo ON|OFFTurn command echo on or off
.exitExit this program
.explain ?ON|OFF?Turn output mode suitable for EXPLAIN on or off.
.header(s) ON|OFFTurn display of headers on or off
.helpShows this inform­ation.
.import FILE TABLEImport data from FILE into TABLE
.indices ?TABLE?Show names of all indices
.load FILE ?ENTRY?Load an extension library
.log FILE|offTurn logging on or off. FILE can be stderr­/stdout
.mode MODE ?TABLE?Set output mode where MODE is one of: csv, column, html, insert, line, list, tabs, tcl
.nullvalue STRINGPrint STRING in place of NULL values
.output FILENAMESend output to FILENAME
.output stdoutSend output to the screen
.prompt MAIN CONTINUEReplace the standard prompts
.quitExit this program
.restore ?DB? FILERestore content of DB (default “­mai­n”) from FILE
.schema ?TABLE?Show the CREATE statements
.separator STRINGChange separator used by output mode and .import
.showShow the current values for various settings
.stats ON|OFFTurn stats on or off
.tables ?TABLE?List names of tables
.timeout MSTry opening locked tables for MS millis­econds
.width NUM1 NUM2 ...Set column widths for “­col­umn­” mode
.timer ON|OFFTurn the CPU timer measur­ement on or off

SQLite: Options Cheat Sheet

-init fileRead and execute commands from file , which can contain a mix of SQL statements and meta-c­omm­ands.
-echoPrint commands before execution.
-[no]h­eaderTurn headers on or off.
-bailStop after hitting an error.
-inter­activeForce intera­ctive I/O .
-batchForce batch I/O .
-columnQuery results will be displayed in a table like form, using whitespace characters to separate the columns and align the output.
-csvSet output mode to CSV (comma separated values).
-htmlQuery results will be output as simple HTML tables.
-lineQuery results will be displayed with one value per line, rows separated by a blank line. Designed to be easily parsed by scripts or other programs
-listQuery results will be displayed with the separator (|, by default) character between each field value. The default.
-separator separatorSet output field separator. Default is “|”.
-statsPrint memory stats before each finalize.
-nullvalue stringSet string used to represent NULL values. Default is (empty string).
-versionShow SQLite version.
-vfs nameUse name as the default VFS .
-helpShow help on options and exit.

Table of contents