Keys Keys
# Redis Keys Command
[!(#) Redis key(Key)](#)")
The Redis KEYS command is used to find all keys matching a given pattern.
### Syntax
The basic syntax of the Redis KEYS command is as follows:
redis 127.0.0.1:6379> KEYS PATTERN
### Available since
>= 1.0.0
### Return value
An array of keys matching the given pattern.
### Example
First, create some keys and assign corresponding values:
redis 127.0.0.1:6379> SET tutorial1 redis OK redis 127.0.0.1:6379> SET tutorial2 mysql OK redis 127.0.0.1:6379> SET tutorial3 mongodb OK
Find keys starting with "":
redis 127.0.0.1:6379> KEYS *1) "tutorial3"2) "tutorial1"3) "tutorial2"
To retrieve all keys in Redis, use "*".
redis 127.0.0.1:6379> KEYS *1) "tutorial3"2) "tutorial1"3) "tutorial2"
[!(#) Redis key(Key)](#)")
YouTip