3 ms·
https://news.ycombinator.com/item?id=10695305 https://news.ycombinator.com/item?id=10695305 ^ Here is my comment on a previous post for how I am logging all of
by saurik 10y ago
https://news.ycombinator.com/item?id=10695305 https://news.ycombinator.com/item?id=10695305
^ Here is my comment on a previous post for how I am logging all of my bash history in a logical manner (keeping track of terminals and timestamps, etc.) to an sqlite database.
- wolfhumble 10y agoWhere/how do you call this script?
- saurik 10y agoI just stuff that in by .bashrc.
- wolfhumble 10y agoOkay, thanks!
- brbsix 10y agoI've been tempted to do something similar. The context information (e.g. environment, working directory) would be especially helpful, since that's what I'm currently missing. Have you tried https://github.com/umang1912/advanced-shell-history https://github.com/umang1912/advanced-shell-history? That was where I planned to start. Here are a few other projects: https://github.com/thenewwazoo/bash-history-sqlite https://github.com/thenewwazoo/bash-history-sqlite # simple shell script to store Bash history into SQLite3 database https://gist.github.com/pklaus/1e381be8592426568df9 https://gist.github.com/pklaus/1e381be8592426568df9 # simple Python script to store Bash history into Pandas dataframe https://gist.github.com/pklaus/26925cfa1fc6b370e043 https://gist.github.com/pklaus/26925cfa1fc6b370e043 # simple Python script to store Bash history in SQLite3 database https://github.com/fredsmith/history-db https://github.com/fredsmith/history-db # store Bash history in PHP/MySQL web server https://github.com/joshuacronemeyer/shellsink https://github.com/joshuacronemeyer/shellsink # store Bash/Zsh history in Python web server
- saurik 10y agoMost of these are extremely complex for almost no good reason. Storing you bash history "in the cloud" seems like a dumb idea to me, requiring a Python script for this seems gratuitous... and essentially all of these are using PROMPT_COMMAND (except bash-history-sqlite, which seems more legit), which doesn't have the correct behavior. I remember all sorts of issues with the timing of what is logged, how pipes are handled, and interaction with expected history behavior. I'm going to counter-ask: have you tried my script? ;P I recommend starting with my script, but obviously I'm going to be biased. Almost all of my script is the actual SQL parts: you will note that I have almost no shell shenanigans. At least from the perspective of asking me why I haven't tried something else, I feel like you would have to provide some rather extreme motivation at this point to work with one of these much more complex scripts.