How to isolate command history for each shell session?

Previously using the built-in history function of the shell, the command history of each shell session was isolated from each other. Atuin seems to have shared the command history across all shell sessions. Previously I could directly execute the previous command, but now I need to search or move up multiple times to get to it. How can I configure atuin’s behavior to be consistent with before?

You can set

filter_mode = 'session'

In your config file (~/.config/atuin/config.toml)

We also have settings for using a different filter mode for the up arrow

See the docs

1 Like

Thank you so much for your reply! It was extremely helpful for solving my issue.

However, I have discovered a new issue. When I open a new shell session, the default history is blank. If I want to search the history, I need to press Ctrl+r to switch the filter mode. Is there a filter mode similar to ‘session_with_global’? Where the history of the current session continuously adds to the previous history.

If you open a new shell, the session is new thus there is no history for that session.

e.g. I have set my config to this:

filter_mode = "host"
filter_mode_shell_up_key_binding = "session"

So when I want to get the history for the session I just hit the up cursor key. Otherwise I use Ctrl-r instead of the up arrow key (which I have been using until now anyway with fzf). This gives me all commands from the computer I am currently working on. If I need a command from another system, I then switch to global by pressing ctrl-r in the atuin TUI.

But maybe you want to change your up key behavior to host. That’s maybe more what you have been used to before using atuin.

2 Likes

Thank you for your reply. I should read more of the documentation - using it is still somewhat different from the previous behavior, but it’s already good enough to use. Much appreciated.

1 Like

One other option, for the sake of completeness: you can invoke atuin only on ^R, and leave the up-arrow binding to just use the standard shell history (which will be session-local, preloaded with global history at startup, for common shells like bash).

It’s sometimes an easier way to get used to using atuin, especially if your musclememory expects up-arrow to be a quick way to edit and rerun commands with typos.