redis-cli Quick Reference
The commands and data-structure verbs you use against Redis — strings, hashes, lists, sets, sorted sets, and TTLs.
Connect & keys
- Connect
redis-cli -h host -p 6379 -a password- Set / get with TTL
SET k v EX 60·GET k·TTL k- Expire / persist
EXPIRE k 30·PERSIST k- Exists / delete / type
EXISTS k·DEL k·TYPE k- Scan (never KEYS in prod)
SCAN 0 MATCH user:* COUNT 100- Atomic counter
INCR hits·INCRBY hits 5
Hashes & lists
- Hash set/get
HSET u:1 name Al age 30·HGETALL u:1- List push/pop
LPUSH q job·RPOP q·LRANGE q 0 -1- Blocking pop (queue)
BLPOP q 5— wait up to 5s
Sets & sorted sets
- Set add/members
SADD tags a b·SMEMBERS tags·SISMEMBER tags a- Sorted set (leaderboard)
ZADD board 100 alice·ZREVRANGE board 0 9 WITHSCORES- Rank / score
ZRANK board alice·ZSCORE board alice
Ops & debug
- Watch live commands
MONITOR(dev only — heavy)- Memory of a key
MEMORY USAGE k- Server info / clients
INFO·CLIENT LIST- Slow queries
SLOWLOG GET 10- Flush (danger)
FLUSHDB/FLUSHALL