Removing a file whose name is the backslash character
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?
[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.
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!