Back to lessons

Linux Survival Basics

List Tables in a SQLite Database

You need a quick inventory of tables in a SQLite database.

Command

sqlite3 app.db ".tables"

What changed

Nothing changes. The command asks SQLite to list table names.

Danger

safe

When to use it

Use when you inherit a SQLite file or need quick orientation during debugging.

When not to use it

Do not use it to inspect views or detailed schema; follow up with .schema.

Undo or recovery

No undo needed because this command is read-only.

Expected output

A compact list of table names in the database.

demo script

Disposable terminal steps

  1. ls -lh app.db
  2. sqlite3 app.db ".tables"

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ ls -lh app.db
-rw-r--r-- 1 root root 16 Jun 25 13:19 app.db
::exit-code::0
$ sqlite3 app.db ".tables"
events  orders  schema_migrations  users
::exit-code::0

YouTube Short

List SQLite tables fast.

When you get an app.db file, start with dot tables so you know what data exists before querying.

LinkedIn hook

Before querying a database file, see what tables are actually inside it.

Question: What is your first command when someone hands you a SQLite file?

experiments

A/B tests to run

Metric: completion_rate

A: Start with .tables.

B: Inventory the database first.