Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .