ITerm2 receives the previous DIFFERENT command using the up and down arrow keys

I was very unpleasant that if you run one command 5 times, you need to press the arrow key 6 times to get the previous command. Is this some way to change this behavior?

iTerm2 Build 1.0.0.20111020

+6
source share
1 answer

This is not a feature of iTerm, but a feature of the history of your shell. If you use standard Bash, you can put it in your ~/.bashrc :

 export HISTCONTROL=ignoreboth shopt -s histappend # After each command, save and reload history export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" 

The first line tells Bash to ignore duplicate and empty history entries. The second line will combine the history of several open sessions (for example, in several tabs or windows). The thirs line will ensure that history is maintained after each command.

+6
source

Source: https://habr.com/ru/post/906058/


All Articles