11 comments

[ 4.9 ms ] story [ 37.0 ms ] thread
In xonsh your existing shell history can already be an SQLite database
I've been using atuin in my private PC for like half a year now.

It is kinda nice, to quickly search your history and that part works really well, but what I don't like (maybe there are configs for it) is that you:

1. have an additional button press for the usual "get me that last operation" and

2. it searches all sessions (which is mostly nice, but sometimes annoying, I guess)

I changed the configuration so that my up arrow isn't hijacked. That fixed most of my annoyances. For a quick recall from history that I know is one to four back, I can use the up and down arrows. When wanting to actually search, I will use ctrl + r.

You can toggle back and forth between what is being searched. For example, you can search globally, or one session.

you can change the default scope to session or directory. And then cycle through the scopes
I've been using '.bash_history per directory' method for quite a while. Mostly changed 'cd' to see if I'm in /home or /opt and switch the HISTORY_PATH.. then tail -5 the bash_history that is (likely) there.

This allows me to switch context/projects etc and have a valuable history, instead of a whole mashup of all kind of other activities crammed into a single file in $HOME...

Perhaps I could use a single SQLITE database with a fancy invocation to do the same? Ie limit the history to the current subtree commands have been invoked in?

I've been using fzf for this for years, but will check this out!
(comment deleted)
I'll pop in with a related question. (Maybe something to add to atuin?). Is anyone doing this for the output?

I've had iTerm session logging enabled on my personal machine for a while and have found it very useful every now and then when I need to remember what or how I did something a long time ago?

But there is a decently large risk that the output will contain something sensitive I don't want stored, so I'm wondering if there is some project which does this but would allow me to write some rules on what to react, which servers I don't want the output stored from etc.

For now I just manually disable logging when I know I will do something sensitive or when I know it's going to generate a lot of noise I don't want to waste space on. I have a shortcut created so I can select "Toggle logging" with shift+cmd+o.

Just going to repeat my comment from the other post.

I keep my shell history in sqlite database since 2017. Around 120k records at this point. Never synced history from the work laptops. Only personal history. In 2017 wrote my own bash script (later optimized for zsh) to just record everything in sqlite with hooks on prompt. [1] I mostly work right now on Mac, don't need to support Linux anymore, so wrote an app for Mac, that syncs the history over iCloud, and has a GUI interface. [2] Anyway, storing years of shell history somewhere, where you can do complex searches, and actually find some magic command you run a few years ago, is priceless. - [1] https://www.outcoldman.com/en/archive/2017/07/19/dbhist/ - [2] https://loshadki.app/shellhistory/

Storing the current working directory, exit code, timestamp, hostname, run duration, and nearest .git directory path (workspaces) alongside each command is revolutionary, always wondered if there was something off-the-shelf that can do it.

Its fuzzy searcher seems to start up super fast, even after importing a very large zsh_history.