Your First History
Outcome: Atuin is recording you. Your
old shell history is imported into the
database, new commands are being written
there as you run them, and you can see
both kinds of row side by side — with
the difference between them visible in
the data. Check: atuin history list
ends with commands you ran minutes ago,
carrying real exit codes and durations.
Three steps: connect the shell, import the past, then live a little.
Step 1 — connect the shell
Add one line to the end of your
~/.bashrc (chapter 2 explains what it
prints and why):
eval "$(atuin init bash)"
For zsh the same shape works with
atuin init zsh in ~/.zshrc; fish and
others are listed in atuin init --help
(transcript t10-init-help.txt). Open a
new shell — the line only takes
effect in shells started after it
exists, and shells already open will go
on exactly as before, unrecorded. That
one fact explains most "Atuin isn't
working" reports; chapter 15 returns
to it.
Check the connection inside the new shell:
echo $ATUIN_SESSION
A long identifier answers — your session. Empty means the line did not run, and nothing in this shell is being recorded.
Step 2 — import the past
Your old history file still exists, and Atuin can read it:
atuin import bash
Atuin
======================
🌍
🐘🐘🐘🐘
🐢
======================
Importing history...
Importing history from bash
Import complete!
(zsh users: atuin import zsh; the
importer list — fish, nu, PowerShell,
xonsh and more — is in atuin import
--help, transcript t11-importers.txt.
atuin import auto guesses from your
current shell.)
The lab imported a fixture history of
22 commands written for this guide
(atuin-lab/fixtures/bash_history,
deliberately generic: updates, backups,
an ssh to storage.example.com).
Here is what the database made of them,
from transcript t02-import.txt:
$ atuin history list --cmd-only | wc -l
22
$ atuin history list --format "{time} | exit {exit} | {duration} | {directory} | {command}"
2026-10-06 09:14:00 | exit -1 | 0s | unknown | sudo apt update
2026-10-06 16:37:00 | exit -1 | 0s | unknown | sudo apt install -y tmux htop
2026-10-07 00:00:00 | exit -1 | 0s | unknown | df -h
Read that row honestly and it tells you what an import is:
- The times survived — because the
fixture file carried bash's
#epochtimestamp markers (written whenHISTTIMEFORMATis set). A history file without markers gives the importer nothing to work with, and rows arrive stamped at import time instead of when they ran. - Exit code −1, duration 0s, directory "unknown" — bash never knew these things, so the import cannot invent them. −1 is Atuin's "not recorded", and it will matter when you filter by exit code in chapter 7: imported rows are neither successes nor failures, they are unknowns.
history listneeds the shell setup. Run those list commands from a shell where the init line has run. From a bare script they stop with a$ATUIN_SESSIONerror — the trap is photographed in transcriptt90-session-error.txtand explained in chapters 2 and 15.
Step 3 — live in it a little
Now use the shell. The lab ran a small
project session in a fresh tmux pane —
making a folder, writing a note,
searching it, failing twice on purpose,
and packing the result away (full
session: transcript
t03-interactive-session.txt). Ask for
the list again and the new rows are a
different species from the imports:
2026-10-28 11:37:05 | exit 0 | 2s | …/projects/garden-notes | sleep 2
2026-10-28 11:37:08 | exit 2 | 10ms | …/projects/garden-notes | ls /no/such/place
2026-10-28 11:37:09 | exit 1 | 2ms | …/projects/garden-notes | false
Real directories. A real two seconds
for sleep 2. Exit 2 for the ls that
found nothing, exit 1 for false. One
more detail in the full transcript: the
very last row is the atuin history
list command itself, caught at exit
−1 — it was still running when it read
the database, so its own ending had not
been written yet.
From here the database only gets more useful. The rest of the guide is about asking it questions: chapter 5 from the command line, chapter 6 with Ctrl-R.