diff --git a/content/commands/del.md b/content/commands/del.md
index 902c666d86..dfef37357c 100644
--- a/content/commands/del.md
+++ b/content/commands/del.md
@@ -71,14 +71,6 @@ A key is ignored if it does not exist.
(integer) 2
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-SET key1 "Hello"
-SET key2 "World"
-DEL key1 key2 key3
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/exists.md b/content/commands/exists.md
index 09a074ce4e..74abcb7aaa 100644
--- a/content/commands/exists.md
+++ b/content/commands/exists.md
@@ -64,23 +64,13 @@ The user should be aware that if the same existing key is mentioned in the argum
## Examples
{{< clients-example set="cmds_generic" step="exists" description="Foundational: Check if one or more keys exist using EXISTS (returns count of existing keys, useful for conditional logic)" difficulty="beginner" >}}
-SET key1 "Hello"
-EXISTS key1
-EXISTS nosuchkey
-SET key2 "World"
-EXISTS key1 key2 nosuchkey
+> SET key1 "Hello"
+> EXISTS key1
+> EXISTS nosuchkey
+> SET key2 "World"
+> EXISTS key1 key2 nosuchkey
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-SET key1 "Hello"
-EXISTS key1
-EXISTS nosuchkey
-SET key2 "World"
-EXISTS key1 key2 nosuchkey
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/expire.md b/content/commands/expire.md
index a370727454..30006dcfa8 100644
--- a/content/commands/expire.md
+++ b/content/commands/expire.md
@@ -158,20 +158,6 @@ are now fixed.
(integer) 10
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-SET mykey "Hello"
-EXPIRE mykey 10
-TTL mykey
-SET mykey "Hello World"
-TTL mykey
-EXPIRE mykey 10 XX
-TTL mykey
-EXPIRE mykey 10 NX
-TTL mykey
-{{% /redis-cli %}}
-
## Pattern: Navigation session
Imagine you have a web service and you are interested in the latest N pages
diff --git a/content/commands/get.md b/content/commands/get.md
index e8d010ce54..c2ffb761a3 100644
--- a/content/commands/get.md
+++ b/content/commands/get.md
@@ -53,15 +53,14 @@ only handles string values.
## Examples
-{{% redis-cli %}}
-GET nonexisting
-SET mykey "Hello"
-GET mykey
-{{% /redis-cli %}}
-
-### Code examples
-
-{{< clients-example set="set_and_get" step="get" description="Foundational: Retrieve the string value of a key using GET (returns nil if key doesn't exist)" difficulty="beginner" />}}
+{{< clients-example set="set_and_get" step="get" description="Foundational: Retrieve the string value of a key using GET (returns nil if key doesn't exist)" difficulty="beginner" >}}
+> GET nonexisting
+(nil)
+> SET mykey "Hello"
+"OK"
+> GET mykey
+"Hello"
+{{< /clients-example >}}
## Redis Software and Redis Cloud compatibility
diff --git a/content/commands/hdel.md b/content/commands/hdel.md
index 6d7eba2c9f..174b9b4b4e 100644
--- a/content/commands/hdel.md
+++ b/content/commands/hdel.md
@@ -64,22 +64,14 @@ If `key` does not exist, it is treated as an empty hash and this command returns
## Examples
{{< clients-example set="cmds_hash" step="hdel" description="Foundational: Delete one or more fields from a hash using HDEL (returns count of deleted fields, ignores non-existent fields)" difficulty="beginner" >}}
-HSET myhash field1 "foo"
+> HSET myhash field1 "foo"
(integer) 1
-HDEL myhash field1
+> HDEL myhash field1
(integer) 1
-HDEL myhash field2
+> HDEL myhash field2
(integer) 0
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-HSET myhash field1 "foo"
-HDEL myhash field1
-HDEL myhash field2
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/hexpire.md b/content/commands/hexpire.md
index 0285f43a01..b61c2a8264 100644
--- a/content/commands/hexpire.md
+++ b/content/commands/hexpire.md
@@ -120,26 +120,17 @@ Starting with Redis 8, Redis Search has enhanced behavior when handling expiring
## Examples
{{< clients-example set="cmds_hash" step="hexpire" description="Field expiration: Set TTL on individual hash fields using HEXPIRE with conditional options (NX, XX, GT, LT) when you need fine-grained control over field lifecycle" difficulty="intermediate" >}}
-HEXPIRE no-key 20 NX FIELDS 2 field1 field2
+> HEXPIRE no-key 20 NX FIELDS 2 field1 field2
(nil)
-HSET mykey field1 "hello" field2 "world"
+> HSET mykey field1 "hello" field2 "world"
(integer) 2
-HEXPIRE mykey 10 FIELDS 3 field1 field2 field3
+> HEXPIRE mykey 10 FIELDS 3 field1 field2 field3
1) (integer) 1
2) (integer) 1
3) (integer) -2
-HGETALL mykey
+> HGETALL mykey
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-HEXPIRE no-key 20 NX FIELDS 2 field1 field2
-HSET mykey field1 "hello" field2 "world"
-HEXPIRE mykey 10 FIELDS 3 field1 field2 field3
-HGETALL mykey
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/hget.md b/content/commands/hget.md
index 9dee028b01..327cc022ec 100644
--- a/content/commands/hget.md
+++ b/content/commands/hget.md
@@ -62,14 +62,6 @@ Returns the value associated with `field` in the hash stored at `key`.
(nil)
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-HSET myhash field1 "foo"
-HGET myhash field1
-HGET myhash field2
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/hgetall.md b/content/commands/hgetall.md
index b5e59f3703..f59be77b37 100644
--- a/content/commands/hgetall.md
+++ b/content/commands/hgetall.md
@@ -65,14 +65,6 @@ redis> HGETALL myhash
4) "World"
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-HSET myhash field1 "Hello"
-HSET myhash field2 "World"
-HGETALL myhash
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/hmget.md b/content/commands/hmget.md
index d0af86311e..fb966e8626 100644
--- a/content/commands/hmget.md
+++ b/content/commands/hmget.md
@@ -69,14 +69,6 @@ a non-existing `key` will return a list of `nil` values.
>
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-HSET myhash field1 "Hello"
-HSET myhash field2 "World"
-HMGET myhash field1 field2 nofield
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/hset.md b/content/commands/hset.md
index d99fe1a019..3eddfa546a 100644
--- a/content/commands/hset.md
+++ b/content/commands/hset.md
@@ -88,17 +88,6 @@ If `key` doesn't exist, a new key holding a hash is created.
6) "World"
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-HSET myhash field1 "Hello"
-HGET myhash field1
-HSET myhash field2 "Hi" field3 "World"
-HGET myhash field2
-HGET myhash field3
-HGETALL myhash
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/hvals.md b/content/commands/hvals.md
index bc9f70534c..7266013b41 100644
--- a/content/commands/hvals.md
+++ b/content/commands/hvals.md
@@ -61,14 +61,6 @@ redis> HVALS myhash
2) "World"
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-HSET myhash field1 "Hello"
-HSET myhash field2 "World"
-HVALS myhash
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/incr.md b/content/commands/incr.md
index 7236986910..9caaa81919 100644
--- a/content/commands/incr.md
+++ b/content/commands/incr.md
@@ -76,14 +76,6 @@ representation of the integer.
"11"
{{< /clients-example >}}
-Give this command a try in the interactive console:
-
-{{% redis-cli %}}
-SET mykey "10"
-INCR mykey
-GET mykey
-{{% /redis-cli %}}
-
## Pattern: Counter
The counter pattern is the most obvious thing you can do with Redis atomic
diff --git a/content/commands/info.md b/content/commands/info.md
index 66d58c46be..576ddab21c 100644
--- a/content/commands/info.md
+++ b/content/commands/info.md
@@ -72,15 +72,9 @@ It can also take the following values:
When no parameter is provided, the `default` option is assumed.
{{< clients-example set="cmds_servermgmt" step="info" description="Foundational: Get server information and statistics using INFO (supports optional section filtering, returns key-value pairs)" difficulty="beginner" >}}
-INFO
+> INFO
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-INFO
-{{% /redis-cli %}}
-
## Notes
Please note depending on the version of Redis some of the fields have been
diff --git a/content/commands/keys.md b/content/commands/keys.md
index 150a432cd7..20e3694d74 100644
--- a/content/commands/keys.md
+++ b/content/commands/keys.md
@@ -90,14 +90,6 @@ To use pattern with hash tag, see [Hash tags]({{< relref "operate/oss_and_stack/
3) "firstname"
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-{{% redis-cli %}}
-MSET firstname Jack lastname Stuntman age 35
-KEYS *name*
-KEYS a??
-KEYS *
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/llen.md b/content/commands/llen.md
index 7555c57193..aadab894bf 100644
--- a/content/commands/llen.md
+++ b/content/commands/llen.md
@@ -60,14 +60,6 @@ redis> LLEN mylist
(integer) 2
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-LPUSH mylist "World"
-LPUSH mylist "Hello"
-LLEN mylist
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/lpop.md b/content/commands/lpop.md
index 969f1eb998..0b77d4dcf6 100644
--- a/content/commands/lpop.md
+++ b/content/commands/lpop.md
@@ -78,15 +78,6 @@ redis> LRANGE mylist 0 -1
2) "five"
{{< /clients-example>}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-RPUSH mylist "one" "two" "three" "four" "five"
-LPOP mylist
-LPOP mylist 2
-LRANGE mylist 0 -1
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/lpush.md b/content/commands/lpush.md
index 24c7d2f385..4229e3215c 100644
--- a/content/commands/lpush.md
+++ b/content/commands/lpush.md
@@ -79,14 +79,6 @@ redis> LRANGE mylist 0 -1
2) "world"
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-LPUSH mylist "world"
-LPUSH mylist "hello"
-LRANGE mylist 0 -1
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/lrange.md b/content/commands/lrange.md
index 13516cf5b8..5f882718e1 100644
--- a/content/commands/lrange.md
+++ b/content/commands/lrange.md
@@ -101,18 +101,6 @@ redis> LRANGE mylist 5 10
(empty array)
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-RPUSH mylist "one"
-RPUSH mylist "two"
-RPUSH mylist "three"
-LRANGE mylist 0 0
-LRANGE mylist -3 2
-LRANGE mylist -100 100
-LRANGE mylist 5 10
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/mget.md b/content/commands/mget.md
index 968bf03c69..5dbaf107b4 100644
--- a/content/commands/mget.md
+++ b/content/commands/mget.md
@@ -71,14 +71,6 @@ Because of this, the operation never fails.
3) (nil)
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-SET key1 "Hello"
-SET key2 "World"
-MGET key1 key2 nonexisting
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/rpop.md b/content/commands/rpop.md
index 7c6b5355b1..3649a624a1 100644
--- a/content/commands/rpop.md
+++ b/content/commands/rpop.md
@@ -78,15 +78,6 @@ redis> LRANGE mylist 0 -1
2) "two"
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-RPUSH mylist "one" "two" "three" "four" "five"
-RPOP mylist
-RPOP mylist 2
-LRANGE mylist 0 -1
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/rpush.md b/content/commands/rpush.md
index 477eeda749..968b33b239 100644
--- a/content/commands/rpush.md
+++ b/content/commands/rpush.md
@@ -80,14 +80,6 @@ redis> LRANGE mylist 0 -1
2) "world"
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-RPUSH mylist "hello"
-RPUSH mylist "world"
-LRANGE mylist 0 -1
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/sadd.md b/content/commands/sadd.md
index 7eb57eca75..fb85c39bbc 100644
--- a/content/commands/sadd.md
+++ b/content/commands/sadd.md
@@ -74,14 +74,6 @@ redis> SMEMBERS myset
2) "World"
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-SADD myset "Hello" "World"
-SADD myset "World"
-SMEMBERS myset
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/set.md b/content/commands/set.md
index cff7dc2b82..6741a8d11e 100644
--- a/content/commands/set.md
+++ b/content/commands/set.md
@@ -165,16 +165,14 @@ A hash digest is a fixed-size numerical representation of a string value, comput
## Examples
-{{% redis-cli %}}
-SET mykey "Hello"
-GET mykey
-
-SET anotherkey "will expire in a minute" EX 60
-{{% /redis-cli %}}
-
-### Code examples
-
-{{< clients-example set="set_and_get" step="set" description="Foundational: Set the string value of a key using SET (creates key if needed, overwrites existing value, supports expiration options)" difficulty="beginner" />}}
+{{< clients-example set="set_and_get" step="set" description="Foundational: Set the string value of a key using SET (creates key if needed, overwrites existing value, supports expiration options)" difficulty="beginner" >}}
+> SET mykey "Hello"
+"OK"
+> GET mykey
+"Hello"
+> SET anotherkey "will expire in a minute" EX 60
+"OK"
+{{< /clients-example >}}
## Patterns
diff --git a/content/commands/smembers.md b/content/commands/smembers.md
index ba30701ff5..b3ad632d2c 100644
--- a/content/commands/smembers.md
+++ b/content/commands/smembers.md
@@ -63,14 +63,6 @@ redis> SMEMBERS myset
2) "World"
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-SADD myset "Hello"
-SADD myset "World"
-SMEMBERS myset
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/ttl.md b/content/commands/ttl.md
index 97f0244f85..f70480f354 100644
--- a/content/commands/ttl.md
+++ b/content/commands/ttl.md
@@ -75,14 +75,6 @@ See also the [`PTTL`]({{< relref "/commands/pttl" >}}) command that returns the
(integer) 10
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-SET mykey "Hello"
-EXPIRE mykey 10
-TTL mykey
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/zadd.md b/content/commands/zadd.md
index c24276cf74..b5394a5d76 100644
--- a/content/commands/zadd.md
+++ b/content/commands/zadd.md
@@ -186,15 +186,6 @@ If the user inserts all the elements in a sorted set with the same score (for ex
8) "3"
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-ZADD myzset 1 "one"
-ZADD myzset 1 "uno"
-ZADD myzset 2 "two" 3 "three"
-ZRANGE myzset 0 -1 WITHSCORES
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/content/commands/zrange.md b/content/commands/zrange.md
index 5a63659bab..d0b68553f7 100644
--- a/content/commands/zrange.md
+++ b/content/commands/zrange.md
@@ -231,15 +231,6 @@ This example shows how to query the sorted set by score, excluding the value `1`
1) "three"
{{< /clients-example >}}
-Give these commands a try in the interactive console:
-
-{{% redis-cli %}}
-ZADD myzset 1 "one" 2 "two" 3 "three"
-ZRANGE myzset 0 -1
-ZRANGE myzset 2 3
-ZRANGE myzset -2 -1
-{{% /redis-cli %}}
-
## Redis Software and Redis Cloud compatibility
| Redis
Software | Redis
Cloud | Notes |
diff --git a/layouts/develop/single.html b/layouts/develop/single.html
index 77511c978f..52e6fa0fb5 100644
--- a/layouts/develop/single.html
+++ b/layouts/develop/single.html
@@ -1,5 +1,6 @@
{{ define "head" }}
+
{{ end }}
{{ define "main" }}
diff --git a/layouts/partials/tabbed-clients-example.html b/layouts/partials/tabbed-clients-example.html
index 1c7a00d8b2..7218ee5453 100644
--- a/layouts/partials/tabbed-clients-example.html
+++ b/layouts/partials/tabbed-clients-example.html
@@ -39,6 +39,20 @@
{{ warnf "[tabbed-clients-example] Example not found %q for %q" $id $.Page }}
{{ end }}
+{{/* Extract executable CLI commands (lines starting with "> " or "redis> ") for Try It button */}}
+{{ $tryItCommands := slice }}
+{{ if (ne (trim $redisCommands "\n") "") }}
+ {{ range $line := split (trim $redisCommands "\n") "\n" }}
+ {{ $trimmedLine := trim $line " " }}
+ {{ if hasPrefix $trimmedLine "redis> " }}
+ {{ $tryItCommands = $tryItCommands | append (strings.TrimPrefix "redis> " $trimmedLine) }}
+ {{ else if hasPrefix $trimmedLine "> " }}
+ {{ $tryItCommands = $tryItCommands | append (strings.TrimPrefix "> " $trimmedLine) }}
+ {{ end }}
+ {{ end }}
+{{ end }}
+
+
{{ $tabs := slice }}
{{/* Render redis-cli example from inner content if any */}}
{{ if (ne (trim $redisCommands "\n") "") }}
@@ -66,7 +80,22 @@
{{ if and (gt $redisCommandsLineLimitInt 0) (gt $estimatedVisualLineCount $redisCommandsLineLimitInt) }}
{{ $hasCliTrim = true }}
{{ end }}
- {{ $redisCliContent := highlight $trimmedRedisCommands "plaintext" "linenos=false" }}
+ {{/* Render the redis-cli tab as an interactive terminal (form.redis-cli is
+ picked up by cli.js and executed inline). Only redis-cli is interactive;
+ other language tabs stay as static highlighted code. */}}
+ {{ $cliCommandLines := $tryItCommands }}
+ {{ if eq (len $cliCommandLines) 0 }}
+ {{ range $line := $redisCommandLines }}
+ {{ $trimmedCliLine := trim $line " \t\r" }}
+ {{ if $trimmedCliLine }}{{ $cliCommandLines = $cliCommandLines | append $trimmedCliLine }}{{ end }}
+ {{ end }}
+ {{ end }}
+ {{ $cliJoined := delimit $cliCommandLines "\n" }}
+ {{ $cliFormInner := htmlEscape $cliJoined }}
+ {{ $cliSourceAttr := replace (htmlEscape $cliJoined) "\n" "
" }}
+ {{ $redisCliContent := printf "
element, so copy the registered commands instead of reading the DOM.
+ const cliForm = visiblePanel.querySelector('form.redis-cli');
+ if (cliForm) {
+ const cliCode = cliForm.getAttribute('data-cli-source') || cliForm.textContent;
+ navigator.clipboard.writeText(cliCode.trim());
+
+ const cliTooltip = button.querySelector('.tooltiptext');
+ if (cliTooltip) {
+ cliTooltip.style.display = 'block';
+ setTimeout(() => cliTooltip.style.display = 'none', 1000);
+ }
+ return;
+ }
+
let code;
const isCliTrimmed = visiblePanel.getAttribute('data-cli-trimmable') === 'true';
const cliPreviewLines = parseInt(visiblePanel.getAttribute('data-cli-preview-lines') || '0', 10);