Getting Started with SQLite on Linux

SQLite is a compact, cross platform, self-contained relational database management system that is available in the public domain. SQLite is generally not included on Linux systems by default.

Tools like RazorSQL have built-in SQLite support. RazorSQL can create new and edit existing SQLite databases even if SQLite is not installed on your Linux system. To download and try RazorSQL, use the Download link in the header at the top of the page. Once downloaded and unzipped, launch RazorSQL via the Terminal application by opening a Terminal prompt, cd to the directory where RazorSQL was unzipped and then cd into the razorsql directory and execute the following command:


RazorSQL can create a new SQLite database by going to the Connections -> Add Connection Profile menu option, selecting SQLite as the database type, and then on the next screen, entering the location for the new SQLite database file, etc. You can also connect to existing SQLite databases using RazorSQL.

SQLite also provides a Linux command line / terminal shell. SQLite first needs installed on the Linux system before the terminal shell can be used. Users can install SQLite on their Linux systems by using either apt-get (for Debian based systems like Debian or Ubuntu) or yum (for RPM based systems like Fedora). Below are the apt-get and yum commands for installing SQLite on Linux.

sudo apt-get install sqlite3 sudo yum install sqlite

Once the above command has been executed, sqlite will be installed in the /usr/bin directory on the local machine. The executable program location is the following:


To use the command line shell to create a new SQLite database, open up a Terminal window and execute the following command:

sqlite3 sample.db

The sample.db file will not be created until we create a table in the database. To create a test table in the database, execute the following command:

create table test (col1 int, col2 varchar(50));

After executing the above command, a file named sample.db will be created in the directory where you lauched the sqlite3 command. To insert data into the test table, execute the following command:

insert into test values (1, 'one');

To view the data contained in the test table execute the following command:

select * from test;

To exit the command line program, type .quit and then enter.

After exiting the command line program, you can use the following command to connect to your previously created sample.db database:

sqlite3 sample.db

Creating and editing databases is cumbersome using the command line program, so a graphical tool like RazorSQL that is capable of communicating with SQLite makes it much easier to manage your SQLite databases.

RazorSQL is available from here

With RazorSQL, users can create new or edit existing SQLite databases. It also provides an SQLite browser for showing all tables, views, triggers, etc. and an SQL editor for writing queries and statements to execute against the SQLite database.