Atuin (Shell History Sync)

Atuin

Sync, search, and back up shell history with Atuin

Homepage: https://atuin.sh/

Github: https://github.com/atuinsh/atuin

Good Stuff

  • Atuin currently supports Bash, ZSH, Fish and NuShell
    • I'm currently using it on Fish
    • (Note: I haven't tested on how it works if you run multiple shells yourself. Can it sync accross fish and nushell say? Idk)
  • Sane Defaults
  • Snappy performance for my 25,000 commands in the history
  • Easy importing of old history files
  • It gives you an easy way to backup your history when reinstalling OS or moving between devices.
  • Actively developed (As of Jan 2024, at least)
  • Uses Sqlite in the backend :D
  • Tells you how long each command took and what the exit code was
  • Syncing happens in the background (every 10 min by default). So far this has just worked.
    • manually trigger a sync with:
      atuin sync

Bad Stuff

  • Overall, shell history is sensitive information. I'm putting my trust in the developers that their server is a safe place for my data. Relevant blog post here. I could choose to self-host an atuin server, but that has its own risks as well.
  • I don't know a way to write the history back into the actual fish_history file. This may be out of scope for the project, but it could be nice for fish's builtin autocomplete to work better.
  • You can delete entries from the history, but it is very un-ergonomic to do so. You have to do a search and add a --delete flag

Configuration

  • I disabled the up-arrow feature of atuin. I prefer the built in fish up arrow. And in default-atuin-land, ctrl + r does the same thing as uparrow anyway (though this is configurable).
    • The setting to achieve this (which goes in my $HOME/.config/fish/config.fish)
      atuin init fish --disable-up-arrow | source
  • other than that, i think i'm just using the default config

Other Notes

  • History is stored in ~/.local/share/atuin/history.db
    • fish history is stored ~/.local/share/fish/fish_history
sqlite> .schema history
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,
	unique(timestamp, cwd, command)
);