[root@localhost ~]# /usr/local/redis/bin/redis-cli -p 6379
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>
127.0.0.1:6379> select 1
OK
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> keys *
(empty array)
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> lpush k1 a b c d
(integer) 4
127.0.0.1:6379[1]> keys *
1) "k1"
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> lrange k1 0 -1
1) "d"
2) "c"
3) "b"
4) "a"
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> rpush k2 a b c d
(integer) 4
127.0.0.1:6379[1]> lrange k2 0 -1
1) "a"
2) "b"
3) "c"
4) "d"
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> lrange k1 0 -1
1) "d"
2) "c"
3) "b"
4) "a"
127.0.0.1:6379[1]> llen k1
(integer) 4
127.0.0.1:6379[1]> lrange k2 0 -1
1) "a"
2) "b"
3) "c"
4) "d"
127.0.0.1:6379[1]> llen k2
(integer) 4
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> lrange k2 0 -1
1) "a"
2) "b"
3) "c"
4) "d"
127.0.0.1:6379[1]> lpop k2 1
1) "a"
127.0.0.1:6379[1]> lrange k2 0 -1
1) "b"
2) "c"
3) "d"
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> lrange k2 0 -1
1) "b"
2) "c"
3) "d"
127.0.0.1:6379[1]> rpop k2 1
1) "d"
127.0.0.1:6379[1]> lrange k2 0 -1
1) "b"
2) "c"
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> lrange k1 0 -1
1) "d"
2) "c"
3) "b"
4) "a"
127.0.0.1:6379[1]> rpoplpush k1 k3
"a"
127.0.0.1:6379[1]> lrange k1 0 -1
1) "d"
2) "c"
3) "b"
127.0.0.1:6379[1]> lrange k3 0 -1
1) "a"
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> lrange k1 0 -1
1) "d"
2) "c"
3) "b"
127.0.0.1:6379[1]> lindex k1 1
"c"
127.0.0.1:6379[1]> lrange k1 0 -1
1) "d"
2) "c"
3) "b"
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> lpush k4 n m l k j i h
(integer) 7
127.0.0.1:6379[1]> lrange k4 0 -1
1) "h"
2) "i"
3) "j"
4) "k"
5) "l"
6) "m"
7) "n"
127.0.0.1:6379[1]> linsert k4 after k x
(integer) 8
127.0.0.1:6379[1]> lrange k4 0 -1
1) "h"
2) "i"
3) "j"
4) "k"
5) "x"
6) "l"
7) "m"
8) "n"
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> keys *
1) "k1"
2) "k3"
3) "k2"
4) "k4"
127.0.0.1:6379[1]> lpushx k5 a b c d
(integer) 0
127.0.0.1:6379[1]> keys *
1) "k1"
2) "k3"
3) "k2"
4) "k4"
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> rpush k5 a b c a b c d a b c c a
(integer) 12
127.0.0.1:6379[1]> lrange k5 0 -1
1) "a"
2) "b"
3) "c"
4) "a"
5) "b"
6) "c"
7) "d"
8) "a"
9) "b"
10) "c"
11) "c"
12) "a"
127.0.0.1:6379[1]> lrem k5 5 c
(integer) 4
127.0.0.1:6379[1]> lrange k5 0 -1
1) "a"
2) "b"
3) "a"
4) "b"
5) "d"
6) "a"
7) "b"
8) "a"
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> lrange k5 0 -1
1) "a"
2) "b"
3) "a"
4) "b"
5) "d"
6) "a"
7) "b"
8) "a"
127.0.0.1:6379[1]> lset k5 2 c
OK
127.0.0.1:6379[1]> lrange k5 0 -1
1) "a"
2) "b"
3) "c"
4) "b"
5) "d"
6) "a"
7) "b"
8) "a"
127.0.0.1:6379[1]>
127.0.0.1:6379[1]> lrange k5 0 -1
1) "a"
2) "b"
3) "c"
4) "b"
5) "d"
6) "a"
7) "b"
8) "a"
127.0.0.1:6379[1]> ltrim k5 1 3
OK
127.0.0.1:6379[1]> lrange k5 0 -1
1) "b"
2) "c"
3) "b"
127.0.0.1:6379[1]>