Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to perform a reverse command history search in redis-cli

Tags:

redis

How do I do a reverse search on command history in redis-cli? Typing the starting letters and pressing the up arrow doesn't work. Neither does bash style 'ctrl+r'. Please help.

Is there a file where redis saves the command history.

like image 459
akhil_ Avatar asked Oct 30 '14 07:10

akhil_


People also ask

What does Redis-cli command do?

The Redis command line interface ( redis-cli ) is a terminal program used to send commands to and read replies from the Redis server.

How run Redis-cli?

To start Redis client, open the terminal and type the command redis-cli. This will connect to your local server and now you can run any command. In the above example, we connect to Redis server running on the local machine and execute a command PING, that checks whether the server is running or not.

How do I view Redis entries?

To list the keys in the Redis data store, use the KEYS command followed by a specific pattern. Redis will search the keys for all the keys matching the specified pattern. In our example, we can use an asterisk (*) to match all the keys in the data store to get all the keys.

How do I view Redis cache?

For a clustered cache, you would see shards instead. From there, you can expand a cache resource to view all the keys inside it. By clicking on a Redis key name, all its contents will open in a new editor tab. With a collection type Redis key, clicking on it will reveal the individual elements under the key name.


1 Answers

How do I do a reverse search on command history in redis-cli?

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

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

Is there a file where redis saves the command history?

That being said Redis saves the commands history under ~/.rediscli_history which can be obtained with up arrow key.

Also, it supports command auto-completion via the tab key.

like image 187
deltheil Avatar answered Sep 29 '22 19:09

deltheil