title: How to delete all keys in Redis matching pattern from within redis-cli repl?
body: <p>I am trying to delete a bunch of keys matching a prefix using <code>redis-cli</code>.</p>
  
  <p>I have been researching how to do this online and the most common suggestion I have seen is to do it straight from the command line, like this:</p>
  
  <p><code>$ redis-cli [options] KEYS "prefix:*" | xargs redis-cli [options] DEL</code></p>
  
  <p>However, I would prefer to do this <em>inside</em> the <code>redis-cli</code> tool so that I do not have to pass the hostname, port, and auth parameters in the cli command every time I want to delete keys that match a pattern. So far I have tried:</p>
  
  <ul>
  <li><code>DEL "prefix:*"</code></li>
  <li><code>DEL KEYS prefix:*</code></li>
  <li><code>DEL KEYS "prefix:*"</code></li>
  <li><code>KEYS "prefix:*" | DEL</code></li>
  <li><code>KEYS "prefix:*" DEL</code></li>
  </ul>
  
  <p>Is there a way to delete all keys under a prefix from <em>within</em> the <code>redis-cli</code> tool? Is the command line the only way to achieve this?</p>
  
  <p>Feel free to comment if you would like me to clarify more.</p>