Live data from Hacker News

Stinkpot: SQLite-backed shell history

tangled.org

11–20 of 44 posts

Re: Stinkpot: SQLite-backed shell history

#11
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.

Re: Stinkpot: SQLite-backed shell history

#12
post #8

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?

In my case, I use Atuin. It has a concept of "context" so you can easily search the history for commands related to your current directory / project / etc. See [0] for some examples.

Now, I admit I don't use these that often, but they can be useful.

It also does stats and whatnot based on the history. I've never looked at those.

[0] https://docs.atuin.sh/latest/guide/advanced-usage/

Re: Stinkpot: SQLite-backed shell history

#13
post #8

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?

SQLite gives indexes that makes searching and locating previous entries much faster. This is relevant when the history is over 100K entries and one wants to avoid duplicates in history files.

Re: Stinkpot: SQLite-backed shell history

#16
post #13
post #8

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?

SQLite gives indexes that makes searching and locating previous entries much faster. This is relevant when the history is over 100K entries and one wants to avoid duplicates in history files.

I think you're underestimating the speed of modern computers and hard-drives, fzf can search through 100k entries easily without any delay. Try it with `cat /usr/share/dict/words | fzf`, it's extremely responsive (my dictionary is about 235k lines). If you want hard numbers, try piping your shell history through `time grep` and see how long finding an entry takes.

Even if you're on spinning rust, your shell history is probably in cache. You don't really need FST index for this usecase, IMHO.

Re: Stinkpot: SQLite-backed shell history

#17

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.

The readme starts by saying how the author used to use atuin, and why they wrote stinkpot as a less featureful alternative.

Re: Stinkpot: SQLite-backed shell history

#18
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.

Re: Stinkpot: SQLite-backed shell history

#19
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)

Re: Stinkpot: SQLite-backed shell history

#20
post #14

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

I mean, it's an sqlite file on disk. You can sync it however you like. https://litestream.io is a fun choice.
Post reply on HN