Inside the Database
Outcome: you have opened Atuin's
database with your own hands, read its
one table, and can say exactly what is
stored about you — proven from the rows,
not from the documentation. Check: the
sqlite3 commands below run against
any Atuin database, including the lab's
(transcript t07-sqlite.txt), and the
exit-code census matches the story
chapters 4 told.
Everything so far has trusted Atuin's
own printouts. This chapter trusts
nothing: the database is a SQLite file,
sqlite3 is a standard tool (the
subject of a sibling guide, SQLite for
Mere Mortals), and the file opens
readably. Open yours while Atuin is not
mid-write, or open a copy.
The table
sqlite3 ~/.atuin/data/history.db '.tables'
_sqlx_migrations history
One real table (_sqlx_migrations is
the tool's own bookkeeping of schema
versions). Its shape:
$ sqlite3 …/history.db '.schema history' | head -12
CREATE TABLE history (
id text primary key,
timestamp integer not null,
duration integer not null,
exit integer not null,
command text not null,
cwd text not null,
session text not null,
hostname text not null, deleted_at integer,
author text, intent text, shell text, author_kind integer,
unique(timestamp, cwd, command)
);
Thirteen columns, and the first eight
are the story: an id, a timestamp
(nanoseconds since the epoch — divide
by a billion for seconds), a
duration (also nanoseconds), the
exit code, the command text,
the cwd, the session, and the
hostname (stored as host:user).
The last line is a promise with teeth:
no two rows may share timestamp,
directory and command at once — which
is why chapter 15's re-import cannot
duplicate your timestamped history,
only the untimestamped kind.
Rows, honestly read
The lab's census, grouped by exit code:
$ sqlite3 … 'SELECT exit, count(*) FROM history GROUP BY exit ORDER BY exit;'
-1|22
0|11
1|1
2|1
There is the whole guide in four lines:
22 imported rows whose endings nobody
recorded (−1), and the live session's
13 — eleven clean, the deliberate
false at 1, the deliberate ls at 2.
And a close read of the newest rows,
timestamps and durations converted:
when_utc|exit|seconds|command|cwd
2026-10-28 11:37:09|1|0.0|false|…/projects/garden-notes
2026-10-28 11:37:08|2|0.01|ls /no/such/place|…/projects/garden-notes
That is all of it. No keystrokes beyond
the commands themselves, no output the
commands printed (in this version's
core history; the binary's newer
output capture feature is a separate
store this guide does not use), no
files' contents. What Atuin knows about
you is what you ran, where, when, and
how it ended — which is plenty, and is
exactly the inventory chapter 1's rule
asks you to protect.
The neighbours in the folder
ls -la ~/.atuin/data/ in the lab
(transcript t07-sqlite.txt) showed
four residents: history.db itself,
meta.db (bookkeeping), records.db
(the sync record store, chapter 11),
and key — 68 bytes, and the most
sensitive file in the folder: the
encryption key sync uses. The lab never
printed its contents and this guide
never will; chapter 11 explains what
the key is for and what holding it
means.
A closing practical note: because it is just a SQLite file, your ordinary backup habits apply to it — and your ordinary caution should too. Back it up and your history survives a dead disk. Copy it somewhere shared and so does your diary, in readable form, for whoever finds it. Chapter 14 picks that thought up.