Hosting Operations
Read-onlyShow Recent SQLite Events
You need the most recent event rows from a SQLite events table.
Command
sqlite3 app.db "SELECT created_at, event_type FROM events ORDER BY created_at DESC LIMIT 5;"
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 a replacement for durable logs if the table is sampled or pruned.
Expected output
Recent timestamps and event types, newest first.
System impact
Read-only. Nothing changes. The command reads recent rows from the events table.
Recovery / rollback: no state is changed.
When to use it
Use when reconstructing a simple timeline from local app data.
When not to use it
Do not use it as a replacement for durable logs if the table is sampled or pruned.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ sqlite3 app.db ".schema events"
CREATE TABLE users (id INTEGER PRIMARY KEY, email TEXT NOT NULL, created_at TEXT NOT NULL);
CREATE UNIQUE INDEX idx_users_email ON users(email);
CREATE TABLE orders (id INTEGER PRIMARY KEY, user_id INTEGER NOT NULL, total_cents INTEGER NOT NULL, created_at TEXT NOT NULL);
CREATE INDEX idx_orders_user_id ON orders(user_id);
CREATE TABLE events (id INTEGER PRIMARY KEY, event_type TEXT NOT NULL, created_at TEXT NOT NULL);
$ sqlite3 app.db "SELECT created_at, event_type FROM events ORDER BY created_at DESC LIMIT 5;"
2026-06-25T12:10:00Z|checkout_completed
2026-06-25T12:08:00Z|login
2026-06-25T12:05:00Z|page_view
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
sqlite3 app.db ".schema events"sqlite3 app.db "SELECT created_at, event_type FROM events ORDER BY created_at DESC LIMIT 5;"
next steps
Related commands
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;"
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;"
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;"
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;"
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.
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.