Skip to content

Instantly share code, notes, and snippets.

@rimom
rimom / findkeys.sh
Created November 1, 2022 10:15 — forked from patrickhulce/findkeys.sh
Find all keys without a TTL in Redis
#!/bin/sh
redis-cli keys "*" | head -n $1 > keys.txt
cat keys.txt | xargs -n 1 -L 1 redis-cli ttl > ttl.txt
paste -d " " keys.txt ttl.txt | grep .*-1$ | cut -d " " -f 1 | redis-cli del