Skip to content

Instantly share code, notes, and snippets.

@lilongen
Created April 26, 2016 06:16
Show Gist options
  • Save lilongen/ffb3b9821755559e589d74716e6efb7c to your computer and use it in GitHub Desktop.
Save lilongen/ffb3b9821755559e589d74716e6efb7c to your computer and use it in GitHub Desktop.
Delete all keys in redis matching a regular expression
# Deleting all keys in redis that match a regular expression
# General
redis-cli [options] KEYS "prefix:*" | xargs redis-cli [options] DEL
# If authorization is needed
redis-cli -a <AUTH> KEYS "prefix:*" | xargs redis-cli -a <AUTH> DEL
# If no authorization is needed
redis-cli KEYS "prefix:*" | xargs redis-cli DEL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment