CLI Basics
Redis · Reference cheat sheet
CLI Basics
Redis · Reference cheat sheet
📋 Overview
redis-cli is the standard admin and debugging client: run commands, monitor traffic, check latency, and inspect keys safely with SCAN.
🔧 Core concepts
| Command / flag | Purpose |
|---|---|
redis-cli | Interactive REPL |
redis-cli -u redis://host:6379 | URL connect |
redis-cli CMD … | One-shot command |
INFO | Sections of server info |
MONITOR | Stream commands (prod caution) |
SCAN | Iterate keys safely |
--latency | Latency sampler |
| Key inspection | Notes |
|---|---|
TYPE key | Data structure |
EXISTS key | 0/1 |
MEMORY USAGE key | Bytes (if available) |
OBJECT ENCODING | Internal encoding |
💡 Examples
Connect and ping:
redis-cli -h 127.0.0.1 -p 6379 PINGScan keys by prefix:
redis-cli --scan --pattern 'user:*'Info memory:
redis-cli INFO memory⚠️ Pitfalls
KEYS *blocks — never on busy production instances.MONITORis expensive and leaks command data (including values).- Auth: use
AUTH/ ACL users — don't put passwords in shell history casually.