redis Redis Keys Listing all keys


Example

You can list all of the keys in a Redis database by executing the following commands from redis-cli:

KEYS *

The parameter to KEYS is a glob-style pattern matching expression. Examples of suppored patterns include:

h?llo matches hello, hallo and hxllo
h*llo matches hllo and heeeello
h[ae]llo matches hello and hallo, but not hillo
h[^e]llo matches hallo, hbllo, ... but not hello
h[a-b]llo matches hallo and hbllo

Using the KEYS * command can have adverse affects on performance, so it is not recommended against production instances. Use the SCAN operation to search for keys in production code.