Back to commands

Hosting Operations

Read-only

List SQLite User Tables Only

You need to list normal tables from sqlite_master.

Command

sqlite3 app.db "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"

Before you run this

System impact: Read-only. Low when scoped to the shown target.

When not to use it: Do not use it to list indexes or views without changing the type filter.

Expected output

One table name per line, sorted by name.

System impact

Read-only. Nothing changes. The command queries sqlite_master for table names.

Recovery / rollback: no state is changed.

When to use it

Use when .tables output is too compact or you need a script-friendly list.

When not to use it

Do not use it to list indexes or views without changing the type filter.

Watch this command run

Command transcript

This sanitized transcript shows the commands and output shape without exposing host details.

demo@lab:~$

$ sqlite3 app.db ".tables"

events  orders  schema_migrations  users

$ sqlite3 app.db "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"

users
orders
events
schema_migrations
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

  1. sqlite3 app.db ".tables"
  2. sqlite3 app.db "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"

next steps

Related commands

Hosting Operations Read-only

Show Recent SQLite Events

For small apps, the quickest timeline may be inside the SQLite file.

sqlite3 app.db "SELECT created_at, event_type FROM events ORDER BY created_at DESC LIMIT 5;"
Hosting Operations Read-only

Count SQLite Events by Type

A noisy event type stands out faster when you group it.

sqlite3 app.db "SELECT event_type, count(*) FROM events GROUP BY event_type ORDER BY count(*) DESC;"
Hosting Operations Read-only

Count Rows in Key SQLite Tables

A quick row count can reveal empty imports, runaway events, or missing data.

sqlite3 app.db "SELECT 'users', count(*) FROM users UNION ALL SELECT 'orders', count(*) FROM orders UNION ALL SELECT 'events', count(*) FROM events;"
Hosting Operations Read-only

Find Duplicate Emails in SQLite

Duplicate account data is easier to spot with one grouped query.

sqlite3 app.db "SELECT email, count(*) FROM users GROUP BY email HAVING count(*) > 1;"
Hosting Operations Read-only

Show Indexes on a SQLite Table

Slow lookups often start with missing or misunderstood indexes.

sqlite3 app.db "PRAGMA index_list('orders');"
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • lfcs:operations-deployment
  • lfcs:services-logs
  • risk:read-only

Useful for

  • LPIC-1 style command-line practice
  • LFCS style performance tasks
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.