How to search for reverse command history in redis-cli

How to do reverse search in command history in redis-cli? Entering the initial letters and pressing the up arrow does not work. Also there is no bash style 'ctrl + r'. Please, help.

Is there a file in which redis saves the command history.

+6
source share
2 answers

How to do reverse search in command history in redis-cli?

redis-cli uses linenoise , which does not support (yet) reverse search in history:

 /* linenoise.c */ History search like Ctrl+r in readline? 

Is there a file in which redis saves the command history?

At the same time, Redis saves the command history in ~/.rediscli_history , which can be obtained using the up arrow key.

In addition, it supports the automatic completion of a command using the tab key.

+4
source

You can use repl and rlwrap to include reverse-i-search in your redis-cli history via CTRL-r. On Max OS X, I just installed both of them through brew:

 brew install repl brew install rlwrap 

repl expects your history file to be named ~/.{command}_history . For redis-cli it expects ~/.redis-cli_history , but when installing Mac OS X, the history file was named ~/.rediscli_history , so I had to symbolize it like this:

 ln -s ~/.rediscli_history ~/.redis-cli_history 

Now you can run redis-cli using repl redis-cli , and reverse-i-search will be activated. You might want to add an alias to make it easier to run in the future by doing something like

 alias rcli='repl redis-cli' 
0
source

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


All Articles