# -------- History --------
#increase bash history
HISTFILESIZE=10000000
HISTTIMEFORMAT="%FT%R "
HISTSIZE=10000000
# append to .bash_history and reread after each command
export PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
# append to .bash_history instead of overwriting
shopt -s histappend
# dont allow repeated lines
export HISTCONTROL=ignoredups:erasedupsI had a friend in university that used a refurbished hp workstation with a shitload of ram as a desktop computer, and he would find | xargs -L1 cat {} > /dev/null everything in his home directory on login to warm up the filesystem cache. The kernel would then drop stuff not actually needed/accessed nicely over time.
Your HISTFILESIZE is also probably not enough: my .full_history goes back to 2012 and is 2.5x your limit.
Anyone else see this in the bash distro? Seems to be a regression.
The fix of course is to simply delete or hack a '#' into the start of the unwanted lines from the default .bashrc.
# Eternal bash history.
# ---------------------
HISTCONTROL=
HISTFILESIZE=
HISTIGNORE=
HISTSIZE=
HISTTIMEFORMAT="%Y-%m-%dT%T%t"
# read global history
HISTFILE=~/.bash_eternal_history
history -r
# IIF there's no session history directory, create one
if [ ! -d ~/.bash_history ]; then
[ -f ~/.bash_history ] && mv ~/.bash_history ~/.bash_history.0
mkdir ~/.bash_history
fi
# change history file to one for the session
HISTFILE=~/.bash_history/$$
# If it already exists, take a backup
if [ -f "$HISTFILE" ]; then
mv "$HISTFILE" "$HISTFILE"."$(stat "$HISTFILE" --format='%W')"
fi
# save the current session id + process id
{ export SESSION_ID="$(</proc/$$/sessionid)"; } 2> /dev/null
printf "#$(date '+%s')"'\n# starting session:'$SESSION_ID' process:'$$' in:'"$PWD"'\n' > "$HISTFILE" &&
history -r
# Use trap to save history, not just on logout but also EXIT
trap_exit() {
# Append session history to global history
## Append to local history session to file
cp -f "$HISTFILE" /tmp/history.$$.0
history -a
cp -f "$HISTFILE" /tmp/history.$$.1
## Append local history file to global history
printf "#$(date '+%s')"'\n# ending session:'$SESSION_ID' process:'$$' in:'"$PWD"'\n' |
cat "$HISTFILE" - >> ~/.bash_eternal_history
}
trap trap_exit EXITUsing fzf for backwards search sounds interesting, can you elaborate?
My favorite is binding key-up and down to complete using search. That's a game changer
Might sound complex written out like that, but I promise it's worth the investment to set it up and read the manual.