CLI Basics and Core Commands
Harry
· 13 Sep 2026
· 1 views
Strings
SET greeting "hello"
GET greeting
SET counter 0
INCR counter # 1
INCRBY counter 5 # 6
SETEX key 60 value # set with 60s TTLKeys and Expiry
KEYS * # list keys (avoid in production)
EXISTS greeting # 1
TTL key # seconds until expiry
EXPIRE greeting 120
DEL greetingGeneric Utilities
TYPE key # string/list/set/hash/zset/stream
RENAME old new
SELECT 1 # switch database
FLUSHDB # clear current database onlyInstrumentation
INFO
MONITOR # log every command (dev only)
CONFIG GET maxmemoryKey Points
- Strings plus INCR/EXPIRE cover counters and caches.
- TTL and KEYS shape retention and admin.
- SELECT switches logical databases.
- MONITOR is a debugger, never run it in prod traffic.