3 ms·
I have recently accidentally created a folder named “~”. Then I tried deleting it through shell.
by heavenlyblue 7y ago
I have recently accidentally created a folder named “~”. Then I tried deleting it through shell.
- NullPrefix 7y agoYou can "safely" delete it with non-recursive rmdir
- bhaak 7y agoDeleting a dir with rmdir is always safe :-) The other trick that makes dangerous operations always more safe is prepending "./" to the path.
- smichel17 7y agoI did similar, once. I had a script where I misquoted and ended up with a directory starting with ~ It was the only directory starting that way, so I typed "rm -rf ~<TAB><ENTER>" Hit control-C a half second later, but the damage was done. Fortunately most of my important files are backed up. Lesson: when deleting files with tricky names, write the command without flags first, then add "-rf" after the path is confirmed correct.
- heavenlyblue 7y agoI’ve got lucky with some directory that is called .asound or similar. It was the first one in the home directory and it didn’t manage to go beyond that.