Re:How do I prevent accidental rm -rf /*?
by weaksauce on Saturday December 03, 2011 @04:12PM
(#3308841)
One thing that you can do is ls what you want to delete and then do a ^ls^rm -rf to replace ls with rm -rf in the last command if satisfied.
you can even do a ls -rf ./somedirectory and then just do ^ls^rm at least you can in bash on os x.
Re:How do I prevent accidental rm -rf /*?
by DanielRibeiro on Saturday December 03, 2011 @04:12PM
(#3308840)
Yeah, the ./-i file trick is mentioned on the best answer: http://serverfault.com/questions/337082/how-do-i-prevent-acc...
Well, I have done stupid things myself, for example typing "rm -rf / some_dir" instead of "rm -rf /some_dir". I noticed because it was taking a wee bit too long. It is always good to do an ls with the intended pattern first, to check what all files and directories are being matched before invoking rm with the same pattern.