diff options
author | EuAndreh <eu@euandre.org> | 2019-05-30 18:49:20 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2019-05-30 18:49:20 -0300 |
commit | 84895bb5fcde385f707c048d5a4b8885530525c7 (patch) | |
tree | 27aa489f1dafed15eee4517db84fe186a7c48560 | |
parent | Extend =l= alias (diff) | |
download | dotfiles-84895bb5fcde385f707c048d5a4b8885530525c7.tar.gz dotfiles-84895bb5fcde385f707c048d5a4b8885530525c7.tar.xz |
Add extra Bash history configurations
-rw-r--r-- | bash/config.sh | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/bash/config.sh b/bash/config.sh index 37a4806..1a5d48d 100644 --- a/bash/config.sh +++ b/bash/config.sh @@ -11,8 +11,10 @@ case $- in *) return;; esac -# don't put duplicate linesin the history. # See bash(1) for more options -HISTCONTROL=ignoredups +# Don't put duplicate linesin the history. +# Don't store commands that start with an empty space. +# See bash(1) for more options +HISTCONTROL=ignoreboth # append to the history file, don't overwrite it shopt -s histappend @@ -32,3 +34,19 @@ isLinux && { } stty -ixon + + +# Taken from: +# https://sanctum.geek.nz/arabesque/better-bash-history/ + +# Record timestamps +# If you set $HISTTIMEFORMAT to something useful, Bash will record the timestamp of each command in its history. In this variable you can specify the format in which you want this timestamp displayed when viewed with history. I find the full date and time to be useful, because it can be sorted easily and works well with tools like cut and awk. +HISTTIMEFORMAT='%F %T ' + +# Use one command per line +# To make your .bash_history file a little easier to parse, you can force commands that you entered on more than one line to be adjusted to fit on only one with the cmdhist option: +shopt -s cmdhist + +# Store history immediately +# By default, Bash only records a session to the .bash_history file on disk when the session terminates. This means that if you crash or your session terminates improperly, you lose the history up to that point. You can fix this by recording each line of history as you issue it, through the $PROMPT_COMMAND variable: +PROMPT_COMMAND='history -a' |