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

Leave a Reply

Your email address will not be published. Required fields are marked *