Commands Cheat Sheet

Evaluating engineering tools? Get the comparison in Google Sheets

(Perfect for making buy/build decisions or internal reviews.)

Most-used commands
Your email is safe thing.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

Connection and Server Management

valkey-cli -h -p -a
Connect to a Valkey server

valkey-cli
Start the Valkey command-line interface

valkey-server
Start the Valkey server

valkey-sentinel
Start the Valkey Sentinel monitoring tool

info
Display server information and statistics

ping
Test connection to the server

quit
Close the connection

select
Switch to a different database

Key-Value Operations

set
Set the value of a key

get
Get the value of a key

del [ ...]
Delete one or more keys

exists [ ...]
Check if key(s) exist

keys
Find all keys matching the pattern

expire
Set a key's time to live in seconds

ttl
Get the time to live for a key

Data Structure Operations

incr
Increment the integer value of a key

decr
Decrement the integer value of a key

lpush [ ...]
Insert values at the head of a list

rpush [ ...]
Insert values at the tail of a list

lrange
Get a range of elements from a list

hset
Set the value of a hash field

hget
Get the value of a hash field

sadd [ ...]
Add members to a set

smembers
Get all the members in a set

Transactions

multi
Mark the start of a transaction block

exec
Execute all commands issued after MULTI

discard
Discard all commands issued after MULTI

Pub/Sub

subscribe [ ...]
Subscribe to channels

publish
Post a message to a channel

unsubscribe [ [ ...]]
Unsubscribe from channels

Monitoring and Debugging

monitor
Stream all requests received by the server

client list
Get information about client connections

slowlog get []
Get the slow logs

memory usage
Estimate the memory usage of a key