Feature request: Search context around history entry

Not sure if this is already possible, but I haven’t found a way to do it yet:

There are a lot of times when I’m looking to find a collection of commands I’ve issued around the same time. I don’t have good enough shell hygiene to compose all of my steps into one execution, so usually they’re spread across multiple history entries.

It would be baller to be able to search for something like kubectl <something> and then be able to expand context around that entry like grep -A # -B # … Or, at least be able to dive into that point in history w/o losing where it’s at.

1 Like

atuin history list | less

I would also love this. I’ve found three aliases in the meantime which could be helpful:

atuin history list | rg (or grep) which is quick and lets me add context flags at the end, but loses interactivity

atuin history list | fzf --track which is quick and interactive, and the track flag keeps the highlighted line after you remove the search term

atuin history list | lnav (lnav) which lets me interactively search or filter and then disable filters to see full context, lets me filter by search term, directory, and host independently, can define a fancy colored format to match your history list format to make it more readable, and you can use G and g to move to the top and bottom if you need. It’s a bit overkill for just finding a recent command, but if you’re really planning to dig through your history it works great.