Atuin Rocks!: Fuzzy Search for Bash History

Hey everyone,
Around mid November I decided to try Atuin: Github link. Atuin replaces your shell history with an SQLite database. You can also set it up so that your fully encrypted history is synchronized between different machines*.

Before this, while I used the shell history, I cannot say that I was very good at it. If it had been a long time since I had run the command, I was usually better off just trying to figure out what I ran before by typing it out. Of course, sometimes I would have some foresight to make notes or write some commands to a text file so I could pull it up for later use.

I knew I could do better with the regular shell history, but one day I read an article about someone using Autin. The main feature I like about Atuin is that it allows you to do a fuzzy search through your shell history. Like me give you an example. First, if you set up Autin it rebinds up and ctrl-r to use Atuin. When you do that, it looks like this:

Now, lets say I am looking for a Podman command I ran over a week ago. I don’t remember exactly what I ran, but I do remember it was something like ‘podman run --rm’. I know know that there is more to the command than that, but I try with that string anyway:

There it is!
podman run --cap-add CAP_SYS_ADMIN --rm -it --name mash --volume ./publish:/mnt mash

Now, this is a bit of a contrived example, you’re not always going to find the command you’re looking for as the first element in the search results. But it might be close by, or the little snippet of the command you remember might allow you to change your search string to get what you are looking for. Since its a fuzzy search, it shows you the results as you modify the search string, so you sometimes find what you are looking for before you fully are done typing what you were going to search!

Of course, you can use special characters like nvim *.py in your search string so you could see all .py files you’ve opened in Neovim, for example. I have not used that too much yet, but I am sure as I get more familiar with it I will come to use it more and more.

Also, I have not yet put it on my Laptop yet, but I do think it is cool to be able to share my bash history between my Desktop and Laptop. That way if I do something on one machine I could easily replicate on another just by searching my history.

*I do want to note here that the quick start instructions on their GitHub page use Autin’s server for the shell history backup. You do have the option to either using Atuin completely offline or to self-host your own Atuin server if you so choose, but those are in a different set of documentation. I did a little digging and I personally felt safe using Autin’s server because of the encryption, but I understand there are some who would not do that.

4 Likes

Hi jimmy,
That seems OK to me. Would only be a tiny database and no cpu burden, so why not have it?
There is an alternative called McFly. Have you looked at that?
They are both open source and both written in Rust.
Regards,
Neville

1 Like

Hey Neville,
I had not heard of McFly. I looked it ip and it is a bit different than Atuin because it is using a small neural network to search your Bash history. I think the main advantage there is that it could take the context of what you are doing to suggest commands on your history.

I think I will stick with Atuin. I am happy with how it works and McFly is looking for co-maintainers because the original creator doesn’t have time to work on it right now. If that changes though it could be a good suggestion for someone who wants something similar to Atuin.

1 Like