9

I've somehow created a file called \ in a directory (yes, backslash character). I've tried all sorts of sed, find and grep fu but I just can't delete it! I know I could just delete the directory, but is there a more interesting way to fix this?

13
[root@abcdef ~]# touch \\
[root@abcdef ~]# ls -l \\
-rw-r--r--. 1 root root 0 Jul  6 09:29 \
[root@abcdef ~]# rm -f \\
[root@abcdef ~]#

ps. If you are running windows, you have corrupted NTFS.

  • hahaha, if you need to make it hidden make it .\\ - this way you can have folder like .\\folder\\ or just \\folder\\ – Andrew Smith Jul 6 '12 at 16:49
  • Why not just use rm \\ ? In comparison, rm -f \\ has the look of something that is very dangerous (even if technically it is not dangerous). – foghorn May 19 '17 at 21:35
1

Can you be sure that that really is just a backslash?

Thought the following rather amusing session may prove useful to others in a similarly dismayed state as I just was:

[root@x y]# ls -la . | grep -F '\'
-rw-r--r--  1 root root     452 Jun 17 10:28 \
[root@x y]# rm \\
rm: cannot remove '\': No such file or directory
[root@x y]# rm '\'
rm: cannot remove '\': No such file or directory
[root@x y]# for f in *; do echo "#$f#"; done;
# #
#file1#
#file2#
[root@x y]# mv ' ' x
[root@x y]# vim x

FYI, the content appeared to be a dump of awk environment variables.. currently no idea how it got there!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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