Interactive Redis: A Terminal Client for Redis with AutoCompletion and Syntax Highlighting.
See the code
IRedis is a terminal client for redis with auto-completion and syntax highlighting. IRedis lets you type Redis commands smoothly, and displays results in a user-friendly format.
IRedis is an alternative for redis-cli. In most cases, IRedis behaves exactly
the same as redis-cli. Besides, it is safer to use IRedis on production servers
than redis-cli: IRedis will prevent accidentally running dangerous commands,
like KEYS * (see
Redis docs / Latency generated by slow commands).
KEYS then run DEL, IRedis
will auto-complete your command based on KEYS result.CLUSTER MEET IP PORT, IRedis will validate IP and
PORT for you.get json | jq ..iredis --url redis://example.com:6379/1.MOVED response in
cluster mode.--natmap remoteHost:remotePort:localHost:localPort (comma-separated for multiple
nodes).iredis -d prod-redis (see dsn for
more).peek command to check the key's type then automatically call
get/lrange/sscan, etc, depending on types. You don't need to call the
type command then type another command to get the value. peek will also
display the key's length and memory usage.--decode=utf-8, to decode Redis' bytes responses.HELP command, try HELP SET!--prompt option or set via ~/.iredisrc
config file.AUTH command.IRedis supports Python 3.10–3.14. CI also tests Python 3.15 prereleases in an experimental job; prerelease failures do not block changes.
Install via pip:
pip install iredis
pipx is recommended:
pipx install iredis
For Mac users, you can install iredis via brew 🍻
brew install iredis
You can also use your Linux package manager to install IRedis, like apt in
Ubuntu (Only available on Ubuntu 21.04+).
apt install iredis
Or you can download the executable binary with cURL(or wget), untar, then run. It is especially useful when you don't have a python interpreter(E.g. the official Redis docker image which doesn't have Python installed.):
wget https://github.com/laixintao/iredis/releases/download/v1.15.2/iredis.tar.gz \
&& tar -xzf iredis.tar.gz \
&& ./iredis
(Check the release page if you want to download an old version of IRedis.)
Please note that the single binary build only support until IRedis v1.15.2, all versions before IRedis v1.15.2 has the single binary build that you can download directly. After v1.15.2, as the PyOxidizer is no longer maintained, IRedis doesn't do the single binary build either.
Once you install IRedis, you will know how to use it. Just remember, IRedis
supports similar options like redis-cli, like -h for redis-server's host and
-p for port.
Pass a command to execute it once, including from scripts with redirected stdin:
iredis PING </dev/null
When no command is given, IRedis reads commands from piped stdin (for example,
echo PING | iredis) or starts an interactive session when stdin is a terminal.
An explicit command takes precedence over piped input.
$ iredis --help
Usage: iredis [OPTIONS] [CMD]...
IRedis: Interactive Redis
When no command is given, IRedis starts in interactive mode.
Examples:
- iredis
- iredis -d dsn
- iredis -h 127.0.0.1 -p 6379
- iredis -h 127.0.0.1 -p 6379 -a <password>
- iredis --url redis://localhost:7890/3
Type "help" in interactive mode for information on available commands and
settings.
Options:
-h TEXT Server hostname (default: 127.0.0.1).
-p TEXT Server port (default: 6379).
-s, --socket TEXT Server socket (overrides hostname and port).
-n INTEGER Database number.(overwrites dsn/url's db
number)
-u, --username TEXT User name used to auth, will be ignore for
redis version < 6.
-a, --password TEXT Password to use when connecting to the
server.
--url TEXT Use Redis URL to indicate connection(Can set
with env `IREDIS_URL`), Example: redis:/
/[[username]:[password]]@localhost:6379/0
rediss://[[username]:[password]]@localhost:6
379/0 unix://[[username]:[password]]@/pa
th/to/socket.sock?db=0
-d, --dsn TEXT Use DSN configured into the [alias_dsn]
section of iredisrc file. (Can set with env
`IREDIS_DSN`)
--newbie / --no-newbie Show command hints and useful helps.
--iredisrc TEXT Config file for iredis, default is
~/.iredisrc.
--decode TEXT decode response, default is No decode, which
will output all bytes literals.
--client_name TEXT Assign a name to the current connection.
--raw / --no-raw Use raw formatting for replies (default when
STDOUT is not a tty). However, you can use
--no-raw to force formatted output even when
STDOUT is not a tty.
--rainbow / --no-rainbow Display colorful prompt.
--shell / --no-shell Allow to run shell commands, default to
True.
--pager / --no-pager Using pager when output is too tall for your
window, default to True.
--verify-ssl [none|optional|required]
Set the TLS certificate verification
strategy
--prompt TEXT Prompt format (supported interpolations:
{client_name}, {db}, {host}, {path}, {port},
{username}, {client_addr}, {client_id}).
--version Show the version and exit.
--help Show this message and exit.
IRedis support storing server configuration in config file. Here is a DSN config:
[alias_dsn]
dev=redis://localhost:6379/4
staging=redis://username:password@staging-redis.example.com:6379/1
Put this in your iredisrc then connect via iredis -d staging or
iredis -d dev.
--natmap with Redis ClusterUse --natmap when you can connect to a Redis Cluster through local forwarded
ports, but the cluster nodes still advertise different remote or private
addresses in MOVED replies. This usually happens when the cluster is behind
SSH tunnels, Docker port publishing, Kubernetes port-forwarding, or another NAT
layer.
--natmap tells IRedis how to translate the address announced by Redis into
the address that is actually reachable from your machine.
Format:
iredis --natmap remoteHost:remotePort:localHost:localPort
Use a comma-separated list when more than one cluster node needs translation.
Example: suppose the cluster replies with node addresses on a private network:
10.0.0.11:6379
10.0.0.12:6379
10.0.0.13:6379
but you access those nodes locally through SSH tunnels:
127.0.0.1:7001
127.0.0.1:7002
127.0.0.1:7003
then start IRedis like this:
iredis -h 127.0.0.1 -p 7001 \
--natmap 10.0.0.11:6379:127.0.0.1:7001,10.0.0.12:6379:127.0.0.1:7002,10.0.0.13:6379:127.0.0.1:7003
Now when a command hits the wrong node and Redis returns MOVED 12182 10.0.0.12:6379, IRedis will reconnect to 127.0.0.1:7002 and reissue the
command automatically.
You can change the prompt str, the default prompt is:
127.0.0.1:6379>
Which is rendered by {host}:{port}[{db}]> , you can change this via --prompt
option or change
iredisrc
config file. The prompwt string uses python string format engine, supported
interpolations:
{client_name}{db}{host}{path}{port}{username}{client_addr}{client_id}The --prompt utilize
Python String format engine,
so as long as it is a valid string formatter, it will work( anything that
"<your prompt>".format(...) accepts). For example, you can limit your Redis
server host name's length to 5 by setting --prompt to
iredis --prompt '{host:.5s}'.
IRedis supports config files. Command-line options will always take precedence over config. Configuration resolution from highest to lowest precedence is:
$PWD/.iredisrc~/.iredisrc (this path can be changed with iredis --iredisrc $YOUR_PATH)/etc/iredisrcYou can copy the self-explained default config here:
https://raw.githubusercontent.com/laixintao/iredis/master/iredis/data/iredisrc
And then make your own changes.
(If you are using an old versions of IRedis, please use the config file below, and change the version in URL):
https://raw.githubusercontent.com/laixintao/iredis/v1.0.4/iredis/data/iredisrc
IRedis support unix/readline-style REPL keyboard shortcuts, which means keys like Ctrl + F to forward work.
Also:
exit
command.clear
command.IRedis is built and released by GitHub Actions. Whenever a tag is pushed to
the master branch, a new release is built and uploaded to pypi.org, it's very
convenient.
Thus, we release as often as possible, so that users can always enjoy the new features and bugfixes quickly. Any bugfix or new feature will get at least a patch release, whereas big features will get a minor release.
IRedis favors poetry as package management tool. To setup a develop environment on your computer:
First, install poetry (you can do it in a python's virtualenv):
pip install poetry
Then run (which is similar to pip install -e .):
poetry install
Be careful running testcases locally, it may flush you db!!!
With a dedicated Redis server listening on localhost:6379, run the full suite
(including interactive CLI tests) with the matching Redis version:
REDIS_VERSION=7.2 poetry run pytest
Code is formatted with black. After modifying code, run:
black .
We recommend installing pre-commit so black and flake8 run automatically on each git commit:
poetry run pre-commit install
This is a command-line tool, so we don't write logs to stdout.
You can tail -f ~/.iredis.log to see logs, the log is pretty clear, you can
see what actually happens from log files.
IRedis use a git submodule to track current-up-to-date redis-doc version. To catch up with latest:
/data: cp -r redis-doc/commands* iredis/dataprettier --prose-wrap always iredis/data/commands/*.md --writeIf you like iredis, you may also like other cli tools by dbcli:
IRedis is build on the top of prompt_toolkit, a Python library (by Jonathan Slenders) for building rich commandline applications.
Overall
Maintained
Code review
PyPI
Latest release
Releases this year
434 followers · starred Jan 2020
270 followers · starred Jul 2026
61 followers · starred Aug 2024
65 followers · starred Jan 2020
Interactive Redis: A Terminal Client for Redis with AutoCompletion and Syntax Highlighting.
See the code
IRedis is a terminal client for redis with auto-completion and syntax highlighting. IRedis lets you type Redis commands smoothly, and displays results in a user-friendly format.
IRedis is an alternative for redis-cli. In most cases, IRedis behaves exactly
the same as redis-cli. Besides, it is safer to use IRedis on production servers
than redis-cli: IRedis will prevent accidentally running dangerous commands,
like KEYS * (see
Redis docs / Latency generated by slow commands).
KEYS then run DEL, IRedis
will auto-complete your command based on KEYS result.CLUSTER MEET IP PORT, IRedis will validate IP and
PORT for you.get json | jq ..iredis --url redis://example.com:6379/1.MOVED response in
cluster mode.--natmap remoteHost:remotePort:localHost:localPort (comma-separated for multiple
nodes).iredis -d prod-redis (see dsn for
more).peek command to check the key's type then automatically call
get/lrange/sscan, etc, depending on types. You don't need to call the
type command then type another command to get the value. peek will also
display the key's length and memory usage.--decode=utf-8, to decode Redis' bytes responses.HELP command, try HELP SET!--prompt option or set via ~/.iredisrc
config file.AUTH command.IRedis supports Python 3.10–3.14. CI also tests Python 3.15 prereleases in an experimental job; prerelease failures do not block changes.
Install via pip:
pip install iredis
pipx is recommended:
pipx install iredis
For Mac users, you can install iredis via brew 🍻
brew install iredis
You can also use your Linux package manager to install IRedis, like apt in
Ubuntu (Only available on Ubuntu 21.04+).
apt install iredis
Or you can download the executable binary with cURL(or wget), untar, then run. It is especially useful when you don't have a python interpreter(E.g. the official Redis docker image which doesn't have Python installed.):
wget https://github.com/laixintao/iredis/releases/download/v1.15.2/iredis.tar.gz \
&& tar -xzf iredis.tar.gz \
&& ./iredis
(Check the release page if you want to download an old version of IRedis.)
Please note that the single binary build only support until IRedis v1.15.2, all versions before IRedis v1.15.2 has the single binary build that you can download directly. After v1.15.2, as the PyOxidizer is no longer maintained, IRedis doesn't do the single binary build either.
Once you install IRedis, you will know how to use it. Just remember, IRedis
supports similar options like redis-cli, like -h for redis-server's host and
-p for port.
Pass a command to execute it once, including from scripts with redirected stdin:
iredis PING </dev/null
When no command is given, IRedis reads commands from piped stdin (for example,
echo PING | iredis) or starts an interactive session when stdin is a terminal.
An explicit command takes precedence over piped input.
$ iredis --help
Usage: iredis [OPTIONS] [CMD]...
IRedis: Interactive Redis
When no command is given, IRedis starts in interactive mode.
Examples:
- iredis
- iredis -d dsn
- iredis -h 127.0.0.1 -p 6379
- iredis -h 127.0.0.1 -p 6379 -a <password>
- iredis --url redis://localhost:7890/3
Type "help" in interactive mode for information on available commands and
settings.
Options:
-h TEXT Server hostname (default: 127.0.0.1).
-p TEXT Server port (default: 6379).
-s, --socket TEXT Server socket (overrides hostname and port).
-n INTEGER Database number.(overwrites dsn/url's db
number)
-u, --username TEXT User name used to auth, will be ignore for
redis version < 6.
-a, --password TEXT Password to use when connecting to the
server.
--url TEXT Use Redis URL to indicate connection(Can set
with env `IREDIS_URL`), Example: redis:/
/[[username]:[password]]@localhost:6379/0
rediss://[[username]:[password]]@localhost:6
379/0 unix://[[username]:[password]]@/pa
th/to/socket.sock?db=0
-d, --dsn TEXT Use DSN configured into the [alias_dsn]
section of iredisrc file. (Can set with env
`IREDIS_DSN`)
--newbie / --no-newbie Show command hints and useful helps.
--iredisrc TEXT Config file for iredis, default is
~/.iredisrc.
--decode TEXT decode response, default is No decode, which
will output all bytes literals.
--client_name TEXT Assign a name to the current connection.
--raw / --no-raw Use raw formatting for replies (default when
STDOUT is not a tty). However, you can use
--no-raw to force formatted output even when
STDOUT is not a tty.
--rainbow / --no-rainbow Display colorful prompt.
--shell / --no-shell Allow to run shell commands, default to
True.
--pager / --no-pager Using pager when output is too tall for your
window, default to True.
--verify-ssl [none|optional|required]
Set the TLS certificate verification
strategy
--prompt TEXT Prompt format (supported interpolations:
{client_name}, {db}, {host}, {path}, {port},
{username}, {client_addr}, {client_id}).
--version Show the version and exit.
--help Show this message and exit.
IRedis support storing server configuration in config file. Here is a DSN config:
[alias_dsn]
dev=redis://localhost:6379/4
staging=redis://username:password@staging-redis.example.com:6379/1
Put this in your iredisrc then connect via iredis -d staging or
iredis -d dev.
--natmap with Redis ClusterUse --natmap when you can connect to a Redis Cluster through local forwarded
ports, but the cluster nodes still advertise different remote or private
addresses in MOVED replies. This usually happens when the cluster is behind
SSH tunnels, Docker port publishing, Kubernetes port-forwarding, or another NAT
layer.
--natmap tells IRedis how to translate the address announced by Redis into
the address that is actually reachable from your machine.
Format:
iredis --natmap remoteHost:remotePort:localHost:localPort
Use a comma-separated list when more than one cluster node needs translation.
Example: suppose the cluster replies with node addresses on a private network:
10.0.0.11:6379
10.0.0.12:6379
10.0.0.13:6379
but you access those nodes locally through SSH tunnels:
127.0.0.1:7001
127.0.0.1:7002
127.0.0.1:7003
then start IRedis like this:
iredis -h 127.0.0.1 -p 7001 \
--natmap 10.0.0.11:6379:127.0.0.1:7001,10.0.0.12:6379:127.0.0.1:7002,10.0.0.13:6379:127.0.0.1:7003
Now when a command hits the wrong node and Redis returns MOVED 12182 10.0.0.12:6379, IRedis will reconnect to 127.0.0.1:7002 and reissue the
command automatically.
You can change the prompt str, the default prompt is:
127.0.0.1:6379>
Which is rendered by {host}:{port}[{db}]> , you can change this via --prompt
option or change
iredisrc
config file. The prompwt string uses python string format engine, supported
interpolations:
{client_name}{db}{host}{path}{port}{username}{client_addr}{client_id}The --prompt utilize
Python String format engine,
so as long as it is a valid string formatter, it will work( anything that
"<your prompt>".format(...) accepts). For example, you can limit your Redis
server host name's length to 5 by setting --prompt to
iredis --prompt '{host:.5s}'.
IRedis supports config files. Command-line options will always take precedence over config. Configuration resolution from highest to lowest precedence is:
$PWD/.iredisrc~/.iredisrc (this path can be changed with iredis --iredisrc $YOUR_PATH)/etc/iredisrcYou can copy the self-explained default config here:
https://raw.githubusercontent.com/laixintao/iredis/master/iredis/data/iredisrc
And then make your own changes.
(If you are using an old versions of IRedis, please use the config file below, and change the version in URL):
https://raw.githubusercontent.com/laixintao/iredis/v1.0.4/iredis/data/iredisrc
IRedis support unix/readline-style REPL keyboard shortcuts, which means keys like Ctrl + F to forward work.
Also:
exit
command.clear
command.IRedis is built and released by GitHub Actions. Whenever a tag is pushed to
the master branch, a new release is built and uploaded to pypi.org, it's very
convenient.
Thus, we release as often as possible, so that users can always enjoy the new features and bugfixes quickly. Any bugfix or new feature will get at least a patch release, whereas big features will get a minor release.
IRedis favors poetry as package management tool. To setup a develop environment on your computer:
First, install poetry (you can do it in a python's virtualenv):
pip install poetry
Then run (which is similar to pip install -e .):
poetry install
Be careful running testcases locally, it may flush you db!!!
With a dedicated Redis server listening on localhost:6379, run the full suite
(including interactive CLI tests) with the matching Redis version:
REDIS_VERSION=7.2 poetry run pytest
Code is formatted with black. After modifying code, run:
black .
We recommend installing pre-commit so black and flake8 run automatically on each git commit:
poetry run pre-commit install
This is a command-line tool, so we don't write logs to stdout.
You can tail -f ~/.iredis.log to see logs, the log is pretty clear, you can
see what actually happens from log files.
IRedis use a git submodule to track current-up-to-date redis-doc version. To catch up with latest:
/data: cp -r redis-doc/commands* iredis/dataprettier --prose-wrap always iredis/data/commands/*.md --writeIf you like iredis, you may also like other cli tools by dbcli:
IRedis is build on the top of prompt_toolkit, a Python library (by Jonathan Slenders) for building rich commandline applications.
Overall
Maintained
Code review
PyPI
Latest release
Releases this year
434 followers · starred Jan 2020
270 followers · starred Jul 2026
61 followers · starred Aug 2024
65 followers · starred Jan 2020