How to Install SQLite 3 on Ubuntu 16.04

This page provides instructions on how to install SQLite 3 on Ubuntu 16.04, plus some commonly used commands to use SQLite 3 via terminal.

sqlite3 is a terminal-based front-end to the SQLite library that can evaluate queries interactively and display the results in multiple formats. sqlite3 can also be used within shell scripts and other applications to provide batch processing features.

Let us install it:

Step 1: issue the following command to install sqlite3

$ sudo apt-get install sqlite3 libsqlite3-dev

Step 2: check installation (if installed correctly, terminal should give you a prompt and version )

$ sqlite3

Bonus: some commonly used commands for using sqlite

  • To quit (note the dot before “quit”)
 sqlite> .quit    
  •  Create database
# cd to the folder you would like to store the db file

$ sqlite3 your_database_name.db

#It’ll create your_database_name.db in the folder.
  • To check whether the database has been created, issue the following command in sqlite3 terminal
 sqlite> .databases

For more commands (e.g., queries), check out the link I provided below in the references.

References:

sqlite3 – A command line interface for SQLite version 3 (pdf)