Bash history settings to tweak for infinite history, instant appending of commands, and shared history across multiple terminals.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# By Pete Warden, @petewarden | |
# To use this, open ~/.bashrc in your editor of choice, | |
# and place these settings at the end. | |
# Based on https://unix.stackexchange.com/a/48113 and | |
# https://blog.sanctum.geek.nz/better-bash-history/ | |
# Ignore both duplicate commands, and those that start with a space. | |
HISTCONTROL=ignoreboth | |
# Append to the history file, don't overwrite it. | |
shopt -s histappend | |
# Make the maximum size of the history file enormous. | |
HISTSIZE=1000000 | |
HISTFILESIZE=20000000 | |
# This makes the entries easy to sort by time. | |
HISTTIMEFORMAT='%F %T ' | |
# Store each command in the history immediately, not on session close. | |
PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment