Redis command-line client for cache and data structure inspection.
medium risk
redis-cli is the interactive and scripted client for Redis. Used for inspecting cache contents, monitoring live commands, checking memory usage, and diagnosing performance issues. The MONITOR command streams all Redis commands in real time.
| Flag | Meaning |
|---|---|
-h | Host (default: 127.0.0.1) |
-p | Port (default: 6379) |
-n | Database number |
--stat | Live stats mode |
--scan | Scan keys matching pattern |
redis-cli INFO memoryCheck memory usage and fragmentation · explain & risk-check →redis-cli MONITORStream all Redis commands in real time · explain & risk-check →redis-cli --statLive statistics: memory, keys, ops/sec · explain & risk-check →redis-cli DBSIZENumber of keys in current database · explain & risk-check →redis-cli --scan --pattern 'session:*' | wc -lCount session keys matching pattern · explain & risk-check →redis-cli --bigkeysFind the largest keys in the database · explain & risk-check →Use `redis-cli --bigkeys` to find oversized keys before they cause memory pressure. Use `--scan` instead of `KEYS *` in production — KEYS * blocks Redis for the entire scan duration.
Reference text is hand-written and may be incomplete — check man redis-cli for your version. Test destructive commands on a non-production system first.