4 ms·
# infinite history HOSTNAME="$(hostname)" HOSTNAME_SHORT="${HOSTNAME%%.*}" mkdir -p "${HOME}/.history/$(date -u +%Y/%m/)" > /dev/null 2>&1 SESSIONPREFIX
by web007 10y ago
# infinite history
HOSTNAME="$(hostname)"
HOSTNAME_SHORT="${HOSTNAME%%.*}"
mkdir -p "${HOME}/.history/$(date -u +%Y/%m/)" > /dev/null 2>&1
SESSIONPREFIX=$(date -u +%Y/%m/%d.%H.%M.%S)
export HISTFILE="${HOME}/.history/${SESSIONPREFIX}_${HOSTNAME_SHORT}_$$"
Only thing you're missing is `HISTFILE`, and an alias like
alias histgrep='find ~/.history/ -type f -print0 2>/dev/null | xargs -0 grep --color=auto -InH'
https://news.ycombinator.com/item?id=10162189 https://news.ycombinator.com/item?id=10162189 for context