From e6cae908d07ef35374919883c9aa868fb86600cc Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 18 Aug 2016 15:45:51 +1200 Subject: Drastically limit amount of history kept Reading really large files seems to be slow in Bash in general, but it's particularly bad in 4.4rc1. I keep encrypted snapshots of my HISTFILE on my home machine, so it's just a little extra step to search them. --- bash/bashrc | 8 ++++---- pdksh/pdkshrc | 2 +- zsh/zshrc | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bash/bashrc b/bash/bashrc index 220ecec6..7defd85d 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -19,11 +19,11 @@ if shopt -q restricted_shell ; then return fi -# Keep around sixteen million lines of history in file -HISTFILESIZE=$((1 << 24)) +# Keep around four thousand lines of history in file +HISTFILESIZE=$((1 << 12)) -# Keep around four thousand lines of history in memory -HISTSIZE=$((1 << 12)) +# Keep around one thousand lines of history in memory +HISTSIZE=$((1 << 10)) # Ignore duplicate commands and whitespace in history HISTCONTROL=ignoreboth diff --git a/pdksh/pdkshrc b/pdksh/pdkshrc index 6039eea3..48799c2e 100644 --- a/pdksh/pdkshrc +++ b/pdksh/pdkshrc @@ -4,7 +4,7 @@ set -o emacs # Save history HISTFILE=$HOME/.pdksh_history -HISTSIZE=$((1 << 12)) +HISTSIZE=$((1 << 10)) # Load any supplementary scripts for pdkshrc in "$HOME"/.pdkshrc.d/*.pdksh ; do diff --git a/zsh/zshrc b/zsh/zshrc index 90e920ad..014ac3fd 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -3,9 +3,9 @@ bindkey -e # History settings setopt histignorealldups sharehistory -HISTSIZE=$((1 << 12)) -SAVEHIST=$((1 << 24)) HISTFILE=$HOME/.zsh_history +SAVEHIST=$((1 << 12)) +HISTSIZE=$((1 << 10)) # Load POSIX shell functions source "$ENV" -- cgit v1.2.3