skip to content
Alvin Lucillo

List all keys

/ 1 min read

KEYS allows you to list all keys. You can use wildcard operator * like how it’s used in the example below.

 docker exec -it redis redis-cli
127.0.0.1:6379> SET domain1:key1 value1
OK
127.0.0.1:6379> SET domain1:key2 value2
OK
127.0.0.1:6379> SET domain2:key3 value3
OK
127.0.0.1:6379> KEYS 'domain1:*'
1) "domain1:key1"
2) "domain1:key2"
127.0.0.1:6379> KEYS 'domain2:*'
1) "domain2:key3"
127.0.0.1:6379> KEYS 'domain*'
1) "domain2:key3"
2) "domain1:key1"
3) "domain1:key2"
127.0.0.1:6379>