Dumping SQLite databases from the Terminal

First, open the database:

sqlite3 .db

Then set the mode to CSV and turn on headers:

.mode csv
.headers on

Then set the output file:

.out .dmp

Finally, query the database for it to be exported to the file.

SELECT * FROM {{table_name}};

After exiting sqlite, we can then see the output file in the current working directory. We can then cat out the file to see the data from our table.