3

I want to display the ttl of all the keys I have in Redis at once from the redis-cli shell.

I tried things like

redis-cli keys * | xargs redis-cli TTL 

But it's not working, I keep getting the error:

(error) ERR wrong number of arguments for 'ttl' command
Community
  • 1
  • 1
Amaynut
  • 4,091
  • 6
  • 39
  • 44

1 Answers1

3

If you're using bash, be careful with globbing on "*". Also, xargs will need a replace-string like this:

redis-cli KEYS '*' | xargs -I{} redis-cli TTL {}
nnog
  • 1,607
  • 16
  • 23