There are many ways to connect to Redis Server.

This tutorials talks about redis-cli command line utility tool

Redis Cli Commands

Redis CLI is an command line interface that connect to Redis server to read,update and store the objects. It opens interactive shell promt and executes commands

Let’s see some of top 10 commands using redis cli commands

  • How to connect to Redis Service via command line?
redis-cli -h -p 6379 -a password
  • List out all keys
redis-cli  keys *
  • Select Database
redis-cli  select 1
  • Server keyspaces and memory usage
redis-cli  INFO

It prints Server informations such as process id etc Key spaces Database list

  • Set UTF-8 characters into redis cli

use --raw options for setting UTF-8 characters.

redis-cli  --raw
  • Shutdown redis cli with command
redis-cli  shutdown save
redis-cli  shutdown nosave

Can we install redis-cli only in ubuntu in Linux?

Ubuntu has a redis-tools package, redis-cli is one the tool in it.

You can install using below command apt-get or apt command based on ubuntu version

sudo apt-get install redis-tools
sudo apt install redis-tools