Skip to content

Instantly share code, notes, and snippets.

@JeromeParadis
Created September 25, 2011 06:22
Show Gist options
  • Save JeromeParadis/1240295 to your computer and use it in GitHub Desktop.
Save JeromeParadis/1240295 to your computer and use it in GitHub Desktop.
Redis: How delete keys matching a pattern?
redis-cli KEYS "prefix:*" | xargs redis-cli DEL
@femans
Copy link

femans commented Jun 21, 2013

redis-cli -n 1 keys FOO* |sed "s/"^.*")//g"|xargs redis-cli -n 1 del

@femans
Copy link

femans commented Jun 21, 2013

that is, if your database is number 1 and your pattern is FOO* :)

@ghmcadams
Copy link

I just published a command line interface utility to npm and github that allows you to delete keys that match a given pattern (even *) from a Redis database.

You can find the utility here:

https://www.npmjs.com/package/redis-utils-cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment