4 ms·
I once saw a friend nearly delete all their files using tip#3 from the thread: > never use only * as a wildcard. A ./* would save you in most cases My friend
by lucb1e 6y ago
I once saw a friend nearly delete all their files using tip#3 from the thread:
> never use only * as a wildcard. A ./* would save you in most cases
My friend typod that for /* in an rm -rf command but caught it just in time. They seemed like unnecessary characters to me if it does the same as *, and I don't think they do it anymore, but now I'm not sure which is worse...
I suppose good backups just go a long way whatever you do.
- deleted 6y ago[deleted]
- powersnail 6y agoI just did that last weekend! After an allnighter, which isn't easy for me anymore, I typed: ``rm -rf. /*`` with the dot and the space reversed. When the shell threw an error in my face, I thought, "oh, an extra dot." so I deleted the dot and re-run the command. And there goes my configs and most of the dotfiles in my home dir. Luckily, I have backup for some of those, so it wasn't a complete disaster. I don't trust myself doing ``rm`` in commandline anymore.
- pessimizer 6y agoThis has nothing to do with the OP, but I always rehearse my deletions with "ls -d", and after seeing the output hit the up arrow in my command history and replace it with the rm command I wanted to attempt. I also never use -r without intention - a lot of people use it habitually even when not deleting a directory. Lastly, I never -f, I just chmod first.
- SubiculumCode 6y agoI tend to use the command line utility tras-cli instead for these reasons. So easy to screw up with a wild card.
- taylorlunt 6y agoIt doesn't hurt to do some variation of pointing and calling when doing destructive commands like rm https://en.wikipedia.org/wiki/Pointing_and_calling https://en.wikipedia.org/wiki/Pointing_and_calling
- neurostimulant 6y agoThis is why I never use rm when I'm tired or working on important system anymore. I'll just mv the files somewhere for review later. Worst case is I just moved a wrong file and can simply restore it back.