Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

On my server rm always asks me for permission (even though I'm root) when I run it, on my desktop it does not. Like so:

$ rm mod_wsgi-3.3.tar.gz
rm: remove regular file `mod_wsgi-3.3.tar.gz'?

How do I make it stop prompting me?

share|improve this question
    
Maybe it is an alias. List the aliases with alias and remove the alias with unalias rm. –  Marcelo Morales May 4 '11 at 18:24
    
Just remember that if you break your system, you get to keep both pieces. You might want to switch to something like trash-cli to give yourself an undo button for deletion. –  Ryan Thompson May 4 '11 at 18:59
    
@Ryan Thompson - That seems handy, thanks. :) –  Kit Sunde May 4 '11 at 19:11
add comment

3 Answers 3

up vote 6 down vote accepted

I would check if your rm is an alias. Typing alias at the command line you will see all defined aliases. I expect something like

alias rm='rm -i'

If so, the alias is probably defined in in ~/.bashrc, so you can remove the alias altogether or change it to suit your needs.

Alternatively, you can remove the alias for the current terminal session using unalias rm.

share|improve this answer
2  
I consider it wiser to leave this as is and always use rm (-i due to the alias) and when prompted either type yes or ctrl-c and than do a rm -f. Safety first: I borked a complete system using rm where it did not have -i cuz someone else removed it from aliases (otherwise I would have spotted my mistake :D ). –  Rinzwind May 4 '11 at 18:57
    
@Rinzwind - You are probably right, but I'm not overly worried about borking my server system in this case. It's stateless and I have setup script to restore it. I did however once remove half the PHP libs from my system through a badly typed rm, but I find it less annoying to do a big cleanup once, than small things all the time. –  Kit Sunde May 4 '11 at 19:14
    
Sorry to say that, but if you’re not yet experienced enough to find out that your rm is an alias, then you should probably leave safety measures in place. –  MPi Oct 31 '13 at 7:50
add comment

rm -f mod_wsgi-3.3.tar.gz

WARNING: use with caution.

From the man page:

-f, --force ignore nonexistent files, never prompt
share|improve this answer
add comment

Another way to get around the defined alias is to give the full path when you don't want to be prompted:

/bin/rm mod_wsgi-3.3.tar.gz

I like to leave an alias to rm -i in place for safety, for when I'm hacking around in the middle of the night and typing rm .... But when I'm alert enough to remember that I don't want to be prompted, I type /bin/rm ....

share|improve this answer
1  
You can also do command rm /dead/file. command executes it without searching functions or aliases. –  minerz029 Oct 31 '13 at 8:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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