Back to commands

Hosting Operations

Read-only

Back Up a SQLite Database File

You need to create a SQLite backup through sqlite3 instead of a raw file copy.

Command

sqlite3 app.db ".backup backup/app.db"

Before you run this

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

When not to use it: Do not use it as your only production backup plan; automate and verify backups separately.

Expected output

The sqlite3 backup command is quiet on success; verify with ls afterward.

System impact

Read-only. SQLite writes a backup copy to backup/app.db.

When to use it

Use before risky data work, migrations, or manual inspection on a SQLite-backed app.

When not to use it

Do not use it as your only production backup plan; automate and verify backups separately.

Recovery / rollback

Remove the backup file with rm backup/app.db if it was created only for a temporary check.

next steps

Related commands

Hosting Operations Read-only

Check SQLite Database Integrity

When a SQLite-backed app behaves strangely, first rule out file corruption.

sqlite3 app.db "PRAGMA integrity_check;"
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

List SQLite User Tables Only

System metadata tables can distract from the app tables you care about.

sqlite3 app.db "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"
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

Show One SQLite Table Schema

A failed query is often just a wrong assumption about column names.

sqlite3 app.db ".schema users"
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 style performance-task practice
  • Linux+ style troubleshooting review

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