Skip to content

Instantly share code, notes, and snippets.

@hugo53
Created January 17, 2019 09:40
Show Gist options
  • Save hugo53/24afc88e1e774c39bc520c1a4e142265 to your computer and use it in GitHub Desktop.
Save hugo53/24afc88e1e774c39bc520c1a4e142265 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