Adicione a um arquivo de inicialização ~/.profile , ~/.bash_profile ou ~/.bashrc :
# Whenever a command is executed, write it to a global history
export PROMPT_COMMAND="history -a ~/.bash_history.global"
# On C-r run the swap_history_reverse.sh script,
bind -x '"\C-r": "~/swap_history_reverse.sh"'
Crie o seguinte script ~/swap_history_reverse.sh :
#! /usr/bin/env bash
# Point hh to global history
export HISTFILE=~/.bash_history.global
# Reverse search
hh
# Restore local history
export HISTFILE=~/.bash_history
Torne o script executável:
chmod +x ~/swap_history_reverse.sh
Instale hh , consulte INSTALAR .
Quando tudo estiver pronto, abra um novo shell e execute-o.