17

When I do a rm * in zsh, I get something like this:

2014-06-08 10:14:23 $ rm *
zsh: sure you want to delete all the files in /home/assay/assay/log [yn]? y
rm: remove regular file `development.log'? y

First zsh asks me if I am sure I want to delete all, and then rm asks for for each specific file.

How can I just have the zsh verification?

  • 3
    Use rm -f ./*. By default, rm doesn't ask anything unless you don't have write permission to the file. Maybe you have a alias rm='rm -i' – Stéphane Chazelas Jun 8 '14 at 8:53
  • Oh that must be it - I am running the deletes from within a Vagrant shell, and the files are hosted on the laptop file system. Thanks – ardochhigh Jun 8 '14 at 9:35
  • 2
    Just a note, zsh still prompts on "rm -rf *", this can be disabled with setopt rmstarsilent – Matt Jul 10 '15 at 14:17
30

The message “zsh: sure you want to delete all the files” is a zsh feature, specifically triggered by invoking a command called rm with an argument that is * or something/* before glob expansion. You can turn this off with setopt rm_star_silent.

The message “rm: remove regular file” comes from the rm command itself. It will not show up by default, it only appears when rm is invoked with the option -i. If you don't want this message, don't pass that option. Even without -i, rm prompts for confirmation (with a different message) if you try to delete a read-only file; you can remove this confirmation by passing the option -f.

Since you didn't pass -i on the command line, rm is presumably an alias for rm -i (it could also be a function, a non-standard wrapper command, or a different alias, but the alias rm -i is by far the most plausible). Some default configurations include alias rm='rm -i' in their shell initialization files; this could be something that your distribution or your system administrator set up, or something that you picked up from somewhere and added to your configuration file then forgot. Check your ~/.zshrc for an alias definition for rm. If you find one, remove it. If you don't find one, add a command to remove the alias:

unalias rm
| improve this answer | |
6

The correct command to disable the double verification seems to be setopt rm_star_silent. To enable the double verification do setopt no_rm_star_silent.

For more detailed information look at the man page for zshoptions man zshoptionsor http://linux.die.net/man/1/zshoptions

| improve this answer | |
  • or unsetopt rm_star_silent – evandrix Jan 30 '19 at 8:32
2

I don't know why but the following works for me - no questions asked

rm -f **

Or, if directories are involved:

rm -rf **
| improve this answer | |
1

If you are using oh-my-zsh tthe common-aliases plugin includes the rm -i alias.

https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/common-aliases/common-aliases.plugin.zsh

| improve this answer | |
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review – jayhendren Dec 2 '16 at 17:38
  • @jayhendren -- it's not a link to documentation, it's a link to something to install to fix the problem... – Wouter Verhelst Dec 2 '16 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.