On Friday, June 24, 2022 03:02:35 AM Andrew M.A. Cater wrote: > The last suggestion, and it's the simplest: > > rm [filename] -rf > > Train your brain and your fingers to move the rf to the end of the command > so that you _have_ to check what filename you are typing as you type it. > > If you need to be doubly sure rm [filename] -irf will put in the > interactive prompt again.
I like all these suggestions, as well as Thomas' addition (although I'm not sure I'm ambitious enough to go back and edit the comand buffer). I do something slightly different than what Andrew suggests, I put the filespec on the blank command line, and then go back and insert the rm -rf before the filespec. My approach might be slightly safer -- there is less possibility of deleting one (or more than one) (wrong) file by fat fingering something (hitting enter) (I'm good at that :-( before getting the filespec correct. For example, suppose you have files test and test1, and you want to delete test1 but not test -- if you accidentally hit enter after typing test but before typing the 1 you will be disappointed. -- If you reply: snip, snip, and snip again; leave attributions; avoid top posting. A picture is worth a thousand words -- divide by 10 for each minute of video (or audio) or create a transcript and edit it to 10% of the original. (Oxford comma included at no charge.)