{
    "mode": "man",
    "parameter": "SQLITE3",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/SQLITE3/1/json",
    "generated": "2026-05-30T06:05:29Z",
    "synopsis": "sqlite3 [options] [databasefile] [SQL]",
    "sections": {
        "NAME": {
            "content": "sqlite3 - A command line interface for SQLite version 3\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "sqlite3 [options] [databasefile] [SQL]\n\n",
            "subsections": []
        },
        "SUMMARY": {
            "content": "sqlite3  is a terminal-based front-end to the SQLite library that can evaluate queries inter‐\nactively and display the results in multiple formats.  sqlite3 can also be used within  shell\nscripts and other applications to provide batch processing features.\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "To start a sqlite3 interactive session, invoke the sqlite3 command and optionally provide the\nname of a database file.  If the database file does not exist, it will be  created.   If  the\ndatabase file does exist, it will be opened.\n\nFor  example,  to  create a new database file named \"mydata.db\", create a table named \"memos\"\nand insert a couple of records into that table:\n\n$ sqlite3 mydata.db\nSQLite version 3.8.8\nEnter \".help\" for instructions\nsqlite> create table memos(text, priority INTEGER);\nsqlite> insert into memos values('deliver project description', 10);\nsqlite> insert into memos values('lunch with Christine', 100);\nsqlite> select * from memos;\ndeliver project description|10\nlunch with Christine|100\nsqlite>\n\n\nIf no database name is supplied, the ATTACH sql command can be used to attach to existing  or\ncreate  new  database  files.  ATTACH can also be used to attach to multiple databases within\nthe same interactive session.  This is useful for migrating data between databases,  possibly\nchanging the schema along the way.\n\nOptionally,  a  SQL  statement or set of SQL statements can be supplied as a single argument.\nMultiple statements should be separated by semi-colons.\n\nFor example:\n\n$ sqlite3 -line mydata.db 'select * from memos where priority > 20;'\ntext = lunch with Christine\npriority = 100\n\n\n\nSQLITE META-COMMANDS\nThe interactive interpreter offers a set of meta-commands that can be  used  to  control  the\noutput format, examine the currently attached database files, or perform administrative oper‐\nations upon the attached databases (such as rebuilding indices).   Meta-commands  are  always\nprefixed with a dot (.).\n\nA  list  of available meta-commands can be viewed at any time by issuing the '.help' command.\nFor example:\n\nsqlite> .help\n.backup ?DB? FILE      Backup DB (default \"main\") to FILE\n.bail on|off           Stop after hitting an error.  Default OFF\n.clone NEWDB           Clone data into NEWDB from the existing database\n.databases             List names and files of attached databases\n.dump ?TABLE? ...      Dump the database in an SQL text format\nIf TABLE specified, only dump tables matching\nLIKE pattern TABLE.\n.echo on|off           Turn command echo on or off\n.eqp on|off            Enable or disable automatic EXPLAIN QUERY PLAN\n.exit                  Exit this program\n.explain ?on|off?      Turn output mode suitable for EXPLAIN on or off.\nWith no args, it turns EXPLAIN on.\n.fullschema            Show schema and the content of sqlitestat tables\n.headers on|off        Turn display of headers on or off\n.help                  Show this message\n.import FILE TABLE     Import data from FILE into TABLE\n.indices ?TABLE?       Show names of all indices\nIf TABLE specified, only show indices for tables\nmatching LIKE pattern TABLE.\n.load FILE ?ENTRY?     Load an extension library\n.log FILE|off          Turn logging on or off.  FILE can be stderr/stdout\n.mode MODE ?TABLE?     Set output mode where MODE is one of:\ncsv      Comma-separated values\ncolumn   Left-aligned columns.  (See .width)\nhtml     HTML <table> code\ninsert   SQL insert statements for TABLE\nline     One value per line\nlist     Values delimited by .separator string\ntabs     Tab-separated values\ntcl      TCL list elements\n.nullvalue STRING      Use STRING in place of NULL values\n.once FILENAME         Output for the next SQL command only to FILENAME\n.open ?FILENAME?       Close existing database and reopen FILENAME\n.output ?FILENAME?     Send output to FILENAME or stdout\n.print STRING...       Print literal STRING\n.prompt MAIN CONTINUE  Replace the standard prompts\n.quit                  Exit this program\n.read FILENAME         Execute SQL in FILENAME\n.restore ?DB? FILE     Restore content of DB (default \"main\") from FILE\n.save FILE             Write in-memory database into FILE\n.schema ?TABLE?        Show the CREATE statements\nIf TABLE specified, only show tables matching\nLIKE pattern TABLE.\n.separator STRING ?NL? Change separator used by output mode and .import\nNL is the end-of-line mark for CSV\n.shell CMD ARGS...     Run CMD ARGS... in a system shell\n.show                  Show the current values for various settings\n.stats on|off          Turn stats on or off\n.system CMD ARGS...    Run CMD ARGS... in a system shell\n.tables ?TABLE?        List names of tables\nIf TABLE specified, only list tables matching\nLIKE pattern TABLE.\n.timeout MS            Try opening locked tables for MS milliseconds\n.timer on|off          Turn SQL timer on or off\n.trace FILE|off        Output each SQL statement as it is run\n.vfsname ?AUX?         Print the name of the VFS stack\n.width NUM1 NUM2 ...   Set column widths for \"column\" mode\nNegative values right-justify\nsqlite>\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "sqlite3 has the following options:\n",
            "subsections": [
                {
                    "name": "-bail",
                    "content": ""
                },
                {
                    "name": "-batch",
                    "content": ""
                },
                {
                    "name": "-column",
                    "content": "Query results will be displayed in a table like form, using whitespace  characters  to\nseparate the columns and align the output.\n"
                },
                {
                    "name": "-cmd",
                    "content": "run command before reading stdin\n"
                },
                {
                    "name": "-csv",
                    "content": ""
                },
                {
                    "name": "-echo",
                    "content": ""
                },
                {
                    "name": "-init",
                    "content": "Read  and  execute  commands from file , which can contain a mix of SQL statements and\nmeta-commands.\n"
                },
                {
                    "name": "-[no]header",
                    "content": "Turn headers on or off.\n"
                },
                {
                    "name": "-help",
                    "content": ""
                },
                {
                    "name": "-html",
                    "content": ""
                },
                {
                    "name": "-interactive",
                    "content": "Force interactive I/O.\n"
                },
                {
                    "name": "-line",
                    "content": "line.  Designed to be easily parsed by scripts or other programs\n"
                },
                {
                    "name": "-list",
                    "content": "each field value.  The default.\n"
                },
                {
                    "name": "-mmap",
                    "content": "Set default mmap size to N\n"
                },
                {
                    "name": "-nullvalue",
                    "content": "Set string used to represent NULL values.  Default is '' (empty string).\n"
                },
                {
                    "name": "-separator",
                    "content": "Set output field separator.  Default is '|'.\n"
                },
                {
                    "name": "-stats",
                    "content": ""
                },
                {
                    "name": "-version",
                    "content": "Show SQLite version.\n"
                },
                {
                    "name": "-vfs",
                    "content": "Use name as the default VFS.\n\n\n"
                }
            ]
        },
        "INIT FILE": {
            "content": "sqlite3 reads an initialization file to set the configuration of the interactive environment.\nThroughout  initialization, any previously specified setting can be overridden.  The sequence\nof initialization is as follows:\n\no The default configuration is established as follows:\n\n\nmode            = LIST\nseparator       = \"|\"\nmain prompt     = \"sqlite> \"\ncontinue prompt = \"   ...> \"\n\n\no If the file ~/.sqliterc exists, it is processed first.  can be found in the user's home di‐\nrectory, it is read and processed.  It should generally only contain meta-commands.\n\no If the -init option is present, the specified file is processed.\n\no All other command line options are processed.\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "http://www.sqlite.org/cli.html\nThe sqlite3-doc package.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "This  manual  page was originally written by Andreas Rottmann <rotty@debian.org>, for the De‐\nbian GNU/Linux system (but may be used by others). It was subsequently revised by  Bill  Bum‐\ngarner <bbum@mac.com> and further updated by Laszlo Boszormenyi <gcs@debian.hu> .\n\n\n\nFri Oct 31 10:41:31 EDT 2014                          SQLITE3(1)",
            "subsections": []
        }
    },
    "summary": "sqlite3 - A command line interface for SQLite version 3",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Query results will be displayed in a table like form, using whitespace characters to separate the columns and align the output."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "run command before reading stdin"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Read and execute commands from file , which can contain a mix of SQL statements and meta-commands."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Turn headers on or off."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Force interactive I/O."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "line. Designed to be easily parsed by scripts or other programs"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "each field value. The default."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Set default mmap size to N"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Set string used to represent NULL values. Default is '' (empty string)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Set output field separator. Default is '|'."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Show SQLite version."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use name as the default VFS."
        }
    ],
    "examples": [],
    "see_also": []
}