logoalt Hacker News

Stinkpot: SQLite-backed shell history

113 pointsby nerdypepperlast Friday at 12:44 PM37 commentsview on HN

Comments

ptsptstoday at 11:04 AM

As indicated in https://tangled.org/oppi.li/stinkpot/blob/cdf87ffcd36e96f3d4... , this software (stinkpot) still uses Bash PROMPT_COMMAND as an entry point to copy new shell history entries to its database.

PROMPT_COMMAND has the following flaw: a command gets recorded as soon as it has finished. So command which never finish (e.g. because they run for a long time, and the user closes the terminal window, or reboots the system) never get recorded. Another flaw: the users starts a long-running command in terminal window 1, and immediately they want to start a variant of it in terminal window 2, but it's not available in the history.

show 1 reply
NightMKodertoday at 7:35 AM

FWIW I use atuin (https://atuin.sh/) and am reasonably happy with it, especially the infinite capacity & snapiness. Ignoring the sync features, I believe it's also sqlite backed when running in local-only mode.

show 3 replies
themadsenstoday at 8:31 PM

Just enable perpetual bash history and install fzf. That will get you CTRL-R (and a lot of other niceties) out of the box.

lucideertoday at 1:41 PM

<unrelated side note for the author>

I would never normally mention this, but I'm reading this repo on mobile & it seems Forgejo doesn't wrap .txt files on mobile. Any reason not to use .md for a new project in 2026?

show 1 reply
craftkillerlast Friday at 3:41 PM

For those of you on zsh, I have been a big fan of https://github.com/larkery/zsh-histdb

It is written entirely in shell script, with the only dependency being sqlite itself.

gertrundetoday at 11:04 AM

For me personally, while I like the history element, if I'm gathering/storing/searching everything, I'd love to also see the command output with the entered command, giving much better context.

Currently I tend to log all my ssh sessions out to text files and grep through the whole lot to find what I want, so a better version of that would be lovely, especially if it could automatically redact secrets or similar, as I'm aware thats a downside of the current setup.

danofsteel32today at 11:03 AM

I recently “fixed” my bash history since the default experience when using multiple terminals sucks.

https://dandavis.dev/the-bash-history-i-always-wanted.html

I also use fzf to search my history I believe you just need so source the right keybindings file to make ctrl+r use fzf.

show 1 reply
podocarptoday at 7:04 AM

A little curious but too lazy to find out, what's the difference between this and atuin vs fzf?

Also I do like the premise, recently stopped using atuin due to all the extra bells and whistles and just went back to fzf.

show 1 reply
harr01today at 5:23 PM

I have my own version that works without any ctrl-r https://github.com/AIex7/zsh-mouse-and-flex-search.

mkespertoday at 12:56 PM

How do these compare to the fish builtin history search with dir awareness and completion menu? I found it quite an improvement to bash history handling but fish isn't POSIX compatible so sometimes you need to switch back and forth.

show 1 reply
apodiktoday at 8:01 AM

is there a particular reason why i'd want sqlite-backed shell history? i mean sure it works but why not a text file? (which i'd assume is somewhat faster because you can just append)

i guess you could say it's because you may want dates for each command but for that you can just use a CSV or TSV file no?

does it have to do with the searching?

show 3 replies
chaz6today at 11:35 AM

Perfect! I wanted this without all the extras of atuin that I never use.

firasdtoday at 10:22 AM

Would be interesting to have a non-interactive mode so you can ask your AI to look for a command too.. but I guess if it's sqlite underneath then it's already de facto possible (and the the cltr+r may be usable from harnesses too not sure)

kricktoday at 10:11 AM

I'm only interested in how it treats multiline commands in bash. It's the only thing that the default history doesn't do consistently (unless you make it replace \n with ;, which is just unuable). Otherwise, fzf + history works just fine.

shim__today at 8:38 AM

Does it support just synching the db via nextcloud or similar? I'd prefer to stick to the Unix philosophy of one tool for one job instead of native cloud integration

show 1 reply
hakcermanitoday at 8:52 AM

created this gnome-extension to launch a gnome terminal with separate history files. bash script gt.sh [projname] launches a gnome-terminal with a history file in ~/.histories/projname

(https://github.com/appsmatics/gtsh-hist)

blepbleptoday at 8:12 AM

For me the killer feature of atuin is that it allows searching the history of commands executed from the current working directory. Typically I have 10,000 plus commands in history but only a few in the current directory and I tend to run the same complex commands from the same directory.

prologictoday at 7:33 AM

Does this automatically handle deduplication?

pokstadtoday at 3:05 PM

Great name

IshKebabtoday at 8:09 AM

I wonder if the author is aware of McFly. That doesn't have all the features of Atuin that they say they don't want.

someworkktoday at 4:54 PM

[flagged]

soren-achebeyesterday at 9:46 PM

[flagged]

daflkfdslkfdstoday at 3:42 PM

[dead]