$linuxjunkies
>

litecli(1)

A command-line interface for SQLite databases with syntax highlighting, completion, and history.

UbuntuDebianFedoraArch

Synopsis

litecli [OPTIONS] [DATABASE]

Description

litecli is an interactive command-line client for SQLite databases. It provides a user-friendly interface with features like auto-completion, syntax highlighting, and query history, similar to tools like mycli or pgcli.

When invoked without a database argument, litecli opens in memory. Specify a database file path to work with an existing or new SQLite database. Execute SQL queries directly at the prompt, or use special commands prefixed with a backslash.

Common options

FlagWhat it does
-h, --helpShow help message and exit
-v, --versionShow version number and exit
-e, --executeExecute a SQL statement and exit (e.g., -e "SELECT * FROM users")
-f, --fileExecute SQL statements from a file and exit
--no-warnSuppress warning messages
--logfileLog all database queries to a specified file
--no-headerDisable column headers in output
--csvOutput results in CSV format

Examples

Open an interactive session with the SQLite database 'mydb.db'

litecli mydb.db

Open litecli with an in-memory database

litecli

Execute a single query and exit without entering interactive mode

litecli mydb.db -e "SELECT COUNT(*) FROM users;"

Execute all SQL statements from queries.sql file and exit

litecli mydb.db -f queries.sql

Start interactive session and log all queries to query.log

litecli mydb.db --logfile query.log

Open session with CSV-formatted output for query results

litecli mydb.db --csv

Create and open a new SQLite database named newdb.db

litecli newdb.db

Related commands