redis-cli SCAN 0 MATCH 'user:*' COUNT 100

Category: Databases & SQL

redis-cli SCAN 0 MATCH 'user:*' COUNT 100

Iterate keys with a cursor

Returns a batch of matching keys plus a cursor; pass the cursor back as the first argument until it reaches 0 to walk the whole keyspace. COUNT hints the batch size, not an exact number. Related: --scan.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.