Skip to content

Instantly share code, notes, and snippets.

@axelabs
Created November 10, 2015 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save axelabs/59de974199b845280663 to your computer and use it in GitHub Desktop.
Save axelabs/59de974199b845280663 to your computer and use it in GitHub Desktop.
Bash eternal history and autocomplete
# Bash history settings
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
# ssh host autocomp
complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment