Stinkpot: SQLite-backed shell history

(tangled.org)

57 points | by nerdypepper 1 day ago

10 comments

  • NightMKoder 2 hours ago
    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.
    • Valodim 3 minutes ago
      The readme starts by saying how the author used to use atuin, and why they wrote stinkpot as a less featureful alternative.
    • tstenner 1 hour ago
      AFAIK it is always backed by a sqlite DB. That way the sync just populates the DB and the completion process doesn't care (or wait for) the central source.
  • craftkiller 1 day ago
    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.

  • podocarp 2 hours ago
    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.

    • apodik 1 hour ago
      seems to only have session agnostic history and a TUI for searching it, because the author didn't want all the features atuin offers. only 400 LOC too, pretty neat
  • apodik 1 hour ago
    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?

    • vladvasiliu 1 hour ago
      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/

    • fpoling 1 hour ago
      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.
      • OskarS 53 minutes ago
        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.

  • shim__ 1 hour ago
    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
  • hakcermani 54 minutes ago
    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)

  • blepblep 1 hour ago
    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.
  • prologic 2 hours ago
    Does this automatically handle deduplication?
  • IshKebab 1 hour ago
    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.
  • soren-achebe 12 hours ago
    [flagged]