Show HN: Private cloud shell history. Open source server for bashhub
github.com
github.com
the pitch is "Never lose another command again" but you can increase the size of your history file to be pretty enormous. Is being able to find a command you ran 2 years ago really a valuable thing?
# Custom history logging # From: http://blog.andrewhays.net/love-your-terminal # https://web.archive.org/web/20130525150720/http://blog.andre... function precmd() { if [ "$(id -u)" -ne 0 ]; then FULL_CMD_LOG="$HOME/.shlogs/zsh-history-$(date -u "+%Y-%m-%d").log" echo "$USER@`hostname`:`pwd` [$(date)] `\history -1`" >> ${FULL_CMD_LOG} fi }
log_bash_persistent_history()
{
[[
$(history 1) =~ ^\ *[0-9]+\ +([^\ ]+\ [^\ ]+)\ +(.*)$
]]
local date_part="${BASH_REMATCH[1]}"
local command_part="${BASH_REMATCH[2]}"
if [ "$command_part" != "$PERSISTENT_HISTORY_LAST" ]
then
echo $date_part "|" "$command_part" >> ~/.persistent_history
export PERSISTENT_HISTORY_LAST="$command_part"
fi
}
run_on_prompt_command()
{
log_bash_persistent_history
}
alias phgrep='cat ~/.persistent_history|grep --color'
I like the idea of a hub, as I do a lot of work inside docker containers and vms -- so this could be tailored to help me collect all my history.being able to see what directories i was in to run various analyses etc. is really invaluable. or even just how RESTful APIs were used (is it POST or PUT /api/v1/predict?) in various poorly documented stuff.
i also work across various machines, local laptop to powerful GPU node for training etc. so helps to have all that history in a nice central form. i'm just using zsh-histdb though which so far is fine for my needs.
I'm imagining something like a shell history client storing the history on this database, with the server having no knowledge of any of the data, but the client still being able to easily sync it between devices.