Skip to content

The Moving Parts

Outcome: you can name each part of Atuin and say where it keeps things, so that when something later behaves strangely you know which part to interrogate. Check: atuin info on your machine prints the same four paths this chapter describes (the lab's printout is transcript t00-version-and-info.txt).

Five parts do the work.

The binary

One program, atuin (about 50 MB as downloaded). It is written in Rust and carries its own copy of SQLite — the doctor command reports the bundled version (3.46.0 in the lab's build, transcript t01-doctor.txt). There is no separate database server to install or keep alive; the same binary records, searches, counts and (chapter 11) syncs. Version 18 also ships extras this guide does not teach — captured command output, a scripts manager, AI-agent hooks, a wrapped year-in-review — visible in atuin --help and left there; the history core is this guide's whole subject.

The shell hooks

Atuin records nothing until your shell invites it in. The invitation is one line in your shell's startup file:

eval "$(atuin init bash)"

atuin init bash prints a script; the line above runs it. The script loads a small library called bash-preexec (the same mechanism zsh offers natively) that calls functions just before and just after each command runs. "Before" starts a row in the database — command, start time, directory, session. "After" completes it with the duration and the exit code. The pair behind the scenes is atuin history start and atuin history end, which you can see in atuin history --help and call by hand if you ever need to.

The init script also invents the session: a random identifier made by atuin uuid, exported as ATUIN_SESSION, one per shell. Every row carries the session that ran it, which is what lets chapter 7's session filter mean anything. The script only takes effect in interactive shells — remember that when chapter 15's script fails.

Finally, the script binds two keys: Ctrl-R opens the interactive search, and ↑ (up arrow) opens it too, pre-filled with whatever you have begun typing. Either binding can be left off at init time (chapter 10).

The database

Everything lands in one SQLite file:

~/.atuin/data/history.db

One table, history, holds the rows — chapter 9 reads it directly with sqlite3, schema and all. Alongside it in ~/.atuin/data/ sit three neighbours the lab photographed (transcript t07-sqlite.txt):

  • key — the encryption key for sync, made locally on first run. Small file, large consequences: whoever holds it can read synced history (chapter 11).
  • meta.db — a second small database for the tool's own bookkeeping.
  • records.db — the record store that the current sync design is built on; the lab notes its presence and size and otherwise leaves it alone.

The configuration

One file, ~/.atuin/config.toml, in TOML format. atuin default-config prints every setting with its default and an explanation — the lab's guide to chapter 10 came from that printout. Atuin's own paths can move: the ATUIN_HOME and ATUIN_CONFIG_DIR environment variables redirect them, which is how this guide's lab kept its Atuin in a scratch home of its own.

The faces

On top of the same database:

  • The interactive search (chapter 6) — the Ctrl-R window: a query, a list that narrows as you type, and the chosen command returned to your prompt.
  • atuin search (chapter 5) — the same search as a command: it prints matches instead of asking, so scripts and pipes can use it.
  • atuin history — the raw ledger: list, last, and the housekeeping verbs prune and dedup.
  • atuin stats (chapter 8) — counts: your most-run commands, per day or over all time.
  • atuin import (chapter 4) — the one-time bridge from your old history files, with importers for bash, zsh, fish and several others.
  • atuin doctor — a diagnostics printout (version, shell, plugins, sync state) written to be pasted into bug reports; chapter 15 leans on it.

And, behind a door this guide opens only to describe it (chapter 11): registration, login and atuin sync — the account-and-server half of the tool. Nothing in the parts above phones home on a local-only setup, and the lab's configuration switches the two automatic network habits (update checks and automatic sync) off entirely.