Skip to content

Instantly share code, notes, and snippets.

@andrew-hardin
Created June 21, 2019 21:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrew-hardin/a522fb1739ed052d146c4c5d3bc5052c to your computer and use it in GitHub Desktop.
Save andrew-hardin/a522fb1739ed052d146c4c5d3bc5052c to your computer and use it in GitHub Desktop.
Infinite Bash History
#!/usr/bin/env bash
# Eternal bash history
# --------------------
# Undocumented(?) feature which sets the size to "unlimited".
# http://stackoverflow.com/questions/9457233/unlimited-bash-history
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
# Change the file location because certain bash sessions truncate .bash_history file upon close.
# http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
export HISTFILE=~/.infinite_history
# Force prompt to write history after every command.
# Useful when using multiple terminals spread between programs
# or machines with network shared home directory.
# http://superuser.com/questions/20900/bash-history-loss
export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment