4 ms·
Store your zsh history into a sqlite3 database
- torbjorn 9y agoanyone know of something like this for bash?
- pmoriarty 9y agohttps://github.com/barabo/advanced-shell-history https://github.com/barabo/advanced-shell-history
- tenken 9y agohttps://pypi.python.org/pypi/rash https://pypi.python.org/pypi/rash
- thenewwazoo 9y agohttps://github.com/thenewwazoo/bash-history-sqlite https://github.com/thenewwazoo/bash-history-sqlite
- saurik 9y agohttps://news.ycombinator.com/item?id=10695305 https://news.ycombinator.com/item?id=10695305
- wingerlang 9y agoI use this: > export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/.logs/bash-history-$(date "+%Y-%m-%d").log; fi' It just logs everything into files per date, have come in handy at times.
- jamescostian 9y agoThis looks very cool! I especially love the attention to syncing and merging, as well as the section specifically for zsh-autosuggestions. However, I really wish there were performance metrics (e.g. "zsh-autosuggestions used to take me Xms but now they only take Yms, and I have Z entries in my history")
- larkery 9y agoI don't have any timing data and I don't actually use the autosuggest thing (I wrote that for someone else who asked about it), but I can say that I have months of daily use in mine and there's no noticeable query delay or insertion delay so far. Sqlite3 is to thank for that, it's a pretty amazing bit of engineering.
- mjmein 9y agoI've been using this for a while. I like the fact that it stores dates/times of command executed. I plan to combine this with org-mode to quickly get a report of all shell commands executed while I was working on a specific task. Helps if I want to convert it into a guide/blog post.
- eikenberry 9y agoNot that it affects you, but for others that think have date/time in their history zsh supports this with their EXTENDED_HISTORY (setopt extendedhistory) option. Formats history as... : <beginning time>:<elapsed seconds>;<command>
- fs111 9y agoYou can do that w/o external tools, at least in bash. Just set HISTTIMEFORMAT. see man bash.
- pmoriarty 9y agoReddit discussion: https://www.reddit.com/r/zsh/comments/67gsm8/a_thing_i_made_to_put_your_zsh_history_into_a/ https://www.reddit.com/r/zsh/comments/67gsm8/a_thing_i_made_...
- moocowtruck 9y agowhy do i want to know how many times i type ls!!!!! j/k This seems pretty cool
- pmarreck 9y agoit stores those under _BORING_COMMANDS and doesn't log them. Source: Read the source
- lolive 9y agoOffTopic: I have always considered my (bash) history as a profound source of knowledge. I hope one day, some machine learning wizard will create a function extractor from history. Something like: "oh it seems you often chain those commands: .... Let me make a function for you. Here it is: ... How would you like to call it?"
- Buttons840 9y agoHave you tried the ”fish” shell? It's the closest I've seen to what you're describing, but not exactly the same.