The Interactive Search
Outcome: Ctrl-R stops being a cautious tap through single guesses and becomes a window onto everything you have ever run. Check: you can open the search, type part of a command, watch the list narrow, change the list's scope with one more keystroke, and land a chosen command back on your prompt.
Everything in this chapter was driven
for real: a bash shell in a tmux pane,
keystrokes sent to it, the pane captured
as it stood. The screens are transcript
atuin-lab/transcripts/t06-interactive-search.txt,
with the keys pressed noted between
them. A terminal window cannot be pasted
perfectly into a page — blank space is
trimmed — but nothing on the screens was
retyped.
Open it and type
Press Ctrl-R at an empty prompt. A
search box opens at the bottom of the
terminal: a line for results, a status
bar, your query, and below it a preview
of the currently chosen command. Type
rsync and the lab's window showed:
> 0s 20d ago rsync -av ~/Documents/ ~/backups/documents/
[ GLOBAL ] rsync
rsync -av ~/Documents/ ~/backups/documents/
Read it in three parts:
- The result list. One match here.
Each row carries the command's
duration (
0s) and its age (20d ago) before the command itself. The>marks the current choice; ↑ and ↓ move it. - The status bar, showing the scope
in brackets —
[ GLOBAL ]— and your query as you type it. Matching is the fuzzy mode of chapter 5 by default, so the list forgives partial memories. - The preview line, the full text of the chosen command, for the ones too long to fit their row.
A wider query shows the list doing its
job. With tar czf typed, two results
remained, newest first, the cursor on
the most recent:
1 0s 19d ago tar czf photos-2026.tgz ~/Pictures
> 56ms 25s ago tar czf garden-notes-backup.tgz projects/garden-notes
[ GLOBAL ] tar czf
tar czf garden-notes-backup.tgz projects/garden-notes
The scope key: Ctrl-R again
Inside the search, Ctrl-R stops meaning "search" and starts meaning "change scope". Each press cycles the bracketed word — and the same query answers differently under each:
[ HOST ] rsync — same match: this machine ran it
[ SESSION ] — no match: this session did not
[ DIRECTORY ] — no match: not run in this folder
In the lab, rsync survived the HOST
scope (one machine did everything) and
vanished under SESSION and DIRECTORY —
it had been imported, stamped with
the import's session and directory
"unknown" (chapter 4). That empty list
is the lesson: the scopes are not
decoration, they are chapters 4's
recorded facts — session, host,
directory — turned into questions.
Chapter 7 names all six scopes and
shows the same filters working from the
command line.
Taking a command home
Enter closes the search and puts the chosen command on your prompt:
root@htch-runtime:~# tar czf garden-notes-backup.tgz projects/garden-notes
In the lab it arrived unrun, ready to edit or execute with a second Enter — the pane capture shows it sitting at the prompt, and the lab discarded it with Ctrl-C rather than run it twice.
One honest warning, because behaviour
differs by install: Atuin's current
default configuration for fresh
installs sets enter_accept = true,
under which Enter runs the command
immediately and Tab is the key
that places it on the prompt for
editing. The lab's window behaved the
other way. Neither is wrong; not
knowing which one yours does is.
Press Ctrl-R now, pick something
harmless, and learn your own setting
before the day you pick something that
isn't. Chapter 10 shows where the
setting lives.
The other door: up arrow
If you have already typed the start of
a command, ↑ opens the same search
pre-filled with what you typed — the
natural way to finish a half-remembered
command instead of retyping it. If the
up arrow's new job annoys you (it does
some people, for a week), chapter 10
shows how to keep Atuin and give the
arrow back: --disable-up-arrow at
init time, and --disable-ctrl-r
beside it if you want both keys left
exactly as bash made them.