English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Redis KEYS command is used to find all keys that match the given pattern pattern.
Basic syntax of the Redis KEYS command is as follows:
redis 127.0.0.1:6379> KEYS PATTERN
>= 1.0.0
List of keys matching the given pattern (Array).
Firstly, create some keys and assign corresponding values:
redis 127.0.0.1:6379> SET w3codebox1 redis OK redis 127.0.0.1:6379> SET w3codebox2 mysql OK redis 127.0.0.1:6379> SET w3codebox3 mongodb OK
Find keys starting with w3Keys starting with codebox:
redis 127.0.0.1:6379> KEYS w3codebox* 1) "w3codebox3" 2) "w3codebox1" 3) "w3codebox2"
To get all the keys in redis, you can use *。
redis 127.0.0.1:6379> KEYS * 1) "w3codebox3" 2) "w3codebox1" 3) "w3codebox2"