'Remove Files whit name '\' [duplicate]

I make mistake file with this name '' and i do not know how to clear this file
How to remove the file with this name '' ?

 rw-r--r-- 1 root root 1555 Sep 15 12:54 '\' 


Solution 1:[1]

You could follow 2 steps to do this.

1- Get the inode number of that specific file by doing ls -litr Input_file_name

2- Then use following command to delete it by inode number: (replace 1235 with your actual inode number which you get in your previous step)

find . -inum 1235 -exec rm {} \;


Working example: Its a dummy/test example only for understanding purposes.

1- Do ls -lihtr to get inode number:

total 16K
  1227 -rw-r--r-- 1 singh singh   0 Sep 15 08:05 \\\\

2- Now place that in find command as follows to delete that specific file:

find . -inum 1227 -exec rm {} \;

NOTE: As per @JRFerguson's comment, there could be same inode number files/symlinks, so better to give either . or complete path in find command to make sure it deletes the correct file and add -xdev option to above find command too.

Solution 2:[2]

$ rm \\

Works for me (with bash). Or, if you have an interactive file manager available (which might be mc if all you have is a terminal) just use a point-and-click method. It's the shell's escaping that's causing all the problems here.

Solution 3:[3]

You need to double-quote the filename and escape the backslash in the shell with another backslash

rm "'\\'"

Solution 4:[4]

You need to escape both ' and \ with \.

The following command

rm \'\\\'

should do the trick.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Kevin Boone
Solution 3 dbush
Solution 4 wto