@@ -64,6 +64,8 @@ even on the terminal with the `--raw` option:
6464You can force human readable output when writing to a file or in
6565pipe to other commands by using ` --no-raw ` .
6666
67+ For complete command line usage, see [ below] ( #usage ) .
68+
6769## String quoting and escaping
6870
6971When ` redis-cli ` parses a command, whitespace characters automatically delimit the arguments.
@@ -964,3 +966,128 @@ minutes the output stabilizes to the following figures:
964966 140500 Gets/sec | Hits: 135947 (96.76%) | Misses: 4553 (3.24%)
965967
966968With 500MB there is sufficient space for the key quantity (10 million) and distribution (80-20 style).
969+
970+ ## Usage
971+
972+ ```
973+ Usage: redis-cli [OPTIONS] [cmd [arg [arg ...]]]
974+ -h <hostname> Server hostname (default: 127.0.0.1).
975+ -p <port> Server port (default: 6379).
976+ -t <timeout> Server connection timeout in seconds (decimals allowed).
977+ Default timeout is 0, meaning no limit, depending on the OS.
978+ -s <socket> Server socket (overrides hostname and port).
979+ -a <password> Password to use when connecting to the server.
980+ You can also use the REDISCLI_AUTH environment
981+ variable to pass this password more safely
982+ (if both are used, this argument takes precedence).
983+ --user <username> Used to send ACL style 'AUTH username pass'. Needs -a.
984+ --pass <password> Alias of -a for consistency with the new --user option.
985+ --askpass Force user to input password with mask from STDIN.
986+ If this argument is used, '-a' and REDISCLI_AUTH
987+ environment variable will be ignored.
988+ -u <uri> Server URI on format redis://user:password@host:port/dbnum
989+ User, password and dbnum are optional. For authentication
990+ without a username, use username 'default'. For TLS, use
991+ the scheme 'rediss'.
992+ -r <repeat> Execute specified command N times.
993+ -i <interval> When -r is used, waits <interval> seconds per command.
994+ It is possible to specify sub-second times like -i 0.1.
995+ This interval is also used in --scan and --stat per cycle.
996+ and in --bigkeys, --memkeys, --keystats, and --hotkeys per 100 cycles.
997+ -n <db> Database number.
998+ -2 Start session in RESP2 protocol mode.
999+ -3 Start session in RESP3 protocol mode.
1000+ -x Read last argument from STDIN (see example below).
1001+ -X Read <tag> argument from STDIN (see example below).
1002+ -d <delimiter> Delimiter between response bulks for raw formatting (default: \n).
1003+ -D <delimiter> Delimiter between responses for raw formatting (default: \n).
1004+ -c Enable cluster mode (follow -ASK and -MOVED redirections).
1005+ -e Return exit error code when command execution fails.
1006+ -4 Prefer IPv4 over IPv6 on DNS lookup.
1007+ -6 Prefer IPv6 over IPv4 on DNS lookup.
1008+ --raw Use raw formatting for replies (default when STDOUT is
1009+ not a tty).
1010+ --no-raw Force formatted output even when STDOUT is not a tty.
1011+ --quoted-input Force input to be handled as quoted strings.
1012+ --csv Output in CSV format.
1013+ --json Output in JSON format (default RESP3, use -2 if you want to use with RESP2).
1014+ --quoted-json Same as --json, but produce ASCII-safe quoted strings, not Unicode.
1015+ --show-pushes <yn> Whether to print RESP3 PUSH messages. Enabled by default when
1016+ STDOUT is a tty but can be overridden with --show-pushes no.
1017+ --stat Print rolling stats about server: mem, clients, ...
1018+ --latency Enter a special mode continuously sampling latency.
1019+ If you use this mode in an interactive session it runs
1020+ forever displaying real-time stats. Otherwise if --raw or
1021+ --csv is specified, or if you redirect the output to a non
1022+ TTY, it samples the latency for 1 second (you can use
1023+ -i to change the interval), then produces a single output
1024+ and exits.
1025+ --latency-history Like --latency but tracking latency changes over time.
1026+ Default time interval is 15 sec. Change it using -i.
1027+ --latency-dist Shows latency as a spectrum, requires xterm 256 colors.
1028+ Default time interval is 1 sec. Change it using -i.
1029+ --lru-test <keys> Simulate a cache workload with an 80-20 distribution.
1030+ --replica Simulate a replica showing commands received from the master.
1031+ --rdb <filename> Transfer an RDB dump from remote server to local file.
1032+ Use filename of "-" to write to stdout.
1033+ --functions-rdb <filename> Like --rdb but only get the functions (not the keys)
1034+ when getting the RDB dump file.
1035+ --pipe Transfer raw Redis protocol from stdin to server.
1036+ --pipe-timeout <n> In --pipe mode, abort with error if after sending all data.
1037+ no reply is received within <n> seconds.
1038+ Default timeout: 30. Use 0 to wait forever.
1039+ --bigkeys Sample Redis keys looking for keys with many elements (complexity).
1040+ --memkeys Sample Redis keys looking for keys consuming a lot of memory.
1041+ --memkeys-samples <n> Sample Redis keys looking for keys consuming a lot of memory.
1042+ And define number of key elements to sample
1043+ --keystats Sample Redis keys looking for keys memory size and length (combine bigkeys and memkeys).
1044+ --keystats-samples <n> Sample Redis keys looking for keys memory size and length.
1045+ And define number of key elements to sample (only for memory usage).
1046+ --cursor <n> Start the scan at the cursor <n> (usually after a Ctrl-C).
1047+ Optionally used with --keystats and --keystats-samples.
1048+ --top <n> To display <n> top key sizes (default: 10).
1049+ Optionally used with --keystats and --keystats-samples.
1050+ --hotkeys Sample Redis keys looking for hot keys.
1051+ only works when maxmemory-policy is *lfu.
1052+ --scan List all keys using the SCAN command.
1053+ --pattern <pat> Keys pattern when using the --scan, --bigkeys, --memkeys,
1054+ --keystats or --hotkeys options (default: *).
1055+ --count <count> Count option when using the --scan, --bigkeys, --memkeys,
1056+ --keystats or --hotkeys (default: 10).
1057+ --quoted-pattern <pat> Same as --pattern, but the specified string can be
1058+ quoted, in order to pass an otherwise non binary-safe string.
1059+ --intrinsic-latency <sec> Run a test to measure intrinsic system latency.
1060+ The test will run for the specified amount of seconds.
1061+ --eval <file> Send an EVAL command using the Lua script at <file>.
1062+ --ldb Used with --eval enable the Redis Lua debugger.
1063+ --ldb-sync-mode Like --ldb but uses the synchronous Lua debugger, in
1064+ this mode the server is blocked and script changes are
1065+ not rolled back from the server memory.
1066+ --cluster <command> [args...] [opts...]
1067+ Cluster Manager command and arguments (see below).
1068+ --verbose Verbose mode.
1069+ --no-auth-warning Don't show warning message when using password on command
1070+ line interface.
1071+ --help Output this help and exit.
1072+ --version Output version and exit.
1073+
1074+ Cluster Manager Commands:
1075+ Use --cluster help to list all available cluster manager commands.
1076+
1077+ Examples:
1078+ redis-cli -u redis://default:PASSWORD@localhost:6379/0
1079+ cat /etc/passwd | redis-cli -x set mypasswd
1080+ redis-cli -D "" --raw dump key > key.dump && redis-cli -X dump_tag restore key2 0 dump_tag replace < key.dump
1081+ redis-cli -r 100 lpush mylist x
1082+ redis-cli -r 100 -i 1 info | grep used_memory_human:
1083+ redis-cli --quoted-input set '"null-\x00-separated"' value
1084+ redis-cli --eval myscript.lua key1 key2 , arg1 arg2 arg3
1085+ redis-cli --scan --pattern '*:12345*'
1086+ redis-cli --scan --pattern '*:12345*' --count 100
1087+
1088+ (Note: when using --eval the comma separates KEYS[] from ARGV[] items)
1089+
1090+ When no command is given, redis-cli starts in interactive mode.
1091+ Type "help" in interactive mode for information on available commands
1092+ and settings.
1093+ ```
0 commit comments