get

获取指定 key 的值

get key

127.0.0.1:6379> get name
“ledao”

del

删除指定key

del key

127.0.0.1:6379> get num
“1”
127.0.0.1:6379> del num
(integer) 1
127.0.0.1:6379> get num
(nil)

exists

检查给定 key 是否存在

exists key

127.0.0.1:6379> exists name
(integer) 1

type

返回 key 所储存的值的类型删除指定key

type key

127.0.0.1:6379> type name
string

keys

keys *

显示所有key

127.0.0.1:6379> keys *
1)”set3”
2)”age”
3)”l1”
4)”newSet”
5)”l2”
6)”set1”
7)”1”
8)”fruitList”
9)”set2”

keys f*

查找所有以某字符串开头的key

127.0.0.1:6379> keys f*
1)”fruitList”

rename

重命名key

rename key name

127.0.0.1:6379> rename list1 list2
OK

PS.

更多命令:https://www.runoob.com/redis/redis-keys.html