sudo systemctl start redis
: Start Redis servicesudo systemctl stop redis
: Stop Redis servicesudo systemctl restart redis
: Restart Redis servicesudo systemctl status redis
: Check the status of Redis servicesudo systemctl enable redis
: Enable Redis to start on bootsudo systemctl disable redis
: Disable Redis from starting on bootredis-cli
: Start the Redis command-line interfaceredis-cli -h <host> -p <port>
: Connect to a specific Redis instanceredis-cli ping
: Check if Redis is runningSET key value
: Set a string valueGET key
: Get the value of a keyDEL key
: Delete a keyEXISTS key
: Check if a key existsKEYS pattern
: Find all keys matching the given patternEXPIRE key seconds
: Set a key’s time to live in secondsTTL key
: Get the time to live for a keyLPUSH key value [value ...]
: Insert all the specified values at the head of the listRPUSH key value [value ...]
: Insert all the specified values at the tail of the listLPOP key
: Remove and get the first element in a listRPOP key
: Remove and get the last element in a listLRANGE key start stop
: Get a range of elements from a listSADD key member [member ...]
: Add one or more members to a setSMEMBERS key
: Get all the members in a setSREM key member [member ...]
: Remove one or more members from a setSISMEMBER key member
: Check if a member exists in a setHSET key field value
: Set the string value of a hash fieldHGET key field
: Get the value of a hash fieldHDEL key field [field ...]
: Delete one or more hash fieldsHGETALL key
: Get all the fields and values in a hashZADD key score member [score member ...]
: Add one or more members to a sorted setZRANGE key start stop [WITHSCORES]
: Return a range of members in a sorted setZREM key member [member ...]
: Remove one or more members from a sorted setSUBSCRIBE channel [channel ...]
: Listen for messages published to the given channelsPUBLISH channel message
: Post a message to a channelUNSUBSCRIBE [channel [channel ...]]
: Stop listening for messages posted to the given channelsMULTI
: Mark the start of a transaction blockEXEC
: Execute all commands issued after MULTIDISCARD
: Discard all commands issued after MULTIINFO
: Get information and statistics about the serverCONFIG GET parameter
: Get the value of a configuration parameterCONFIG SET parameter value
: Set a configuration parameter to the given valueFLUSHDB
: Remove all keys from the current databaseFLUSHALL
: Remove all keys from all databasesSAVE
: Synchronously save the dataset to diskBGSAVE
: Asynchronously save the dataset to diskLASTSAVE
: Get the UNIX time stamp of the last successful save to diskCLUSTER INFO
: Provide information about the clusterCLUSTER NODES
: Get details about cluster nodesMONITOR
: Listen for all requests received by the server in real-timeSLOWLOG GET [number]
: Get the slow logsAUTH password
: Authenticate to the serverRemember to use appropriate authentication and security measures when working with Redis, especially in production environments.