Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use my .bash_history all the time using ctrl-R to find complex commands I figured out in the past and since forgot how to run.

I have a large history (50,000) lines, managed by these commands in my .bashrc file. This was certainly copied from someone on the internet in years past:

#for keeping the history from all shells
export HISTIGNORE=lst:df*:top:ssh*:cd*  # don't put these in history
export HISTCONTROL=erasedups    # no duplicate entries
export HISTSIZE=50000           # 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 -r; $PROMPT_COMMAND"

Now, my problem is that with a huge history, I notice my prompt getting a bit laggy. If I nuke my .bash_history things get snappy again. I notice I have a lot of crud in my .bash_history, but manually curating it is not worth the time.

Who has a suggestion to allow me to keep my .bash_history dependance, but to speed up my prompt?

share|improve this question

1 Answer 1

Lose export PROMPT_COMMAND="history -a; history -r; $PROMPT_COMMAND". You don't need to save each command in turn, they are saved automatically at the end of the session.

share|improve this answer
    
yes but if I have a number of shells going it won't add the up to date history to each unless I close them, no? –  lonestar21 Nov 29 '12 at 23:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.