I created a file named "?", is anybody know how to delete it?
It seems that ? is a special character in linux, I use Redhat as my OS.
I have already tried
rm ?
rm "?"
rm \?
They all failed and I got the error indicated that the file doesn't exist.
The rm command deletes files in a Linux. The command unlinks the data from the file name, allowing the user to overwrite on that particular storage space. Wildcards can be used with this command.
Using rm Command To remove a file with a particular extension, use the command 'rm'. This command is very easy to use, and its syntax is something like this. In the appropriate command, 'filename1', 'filename2', etc., refer to the names, plus their full paths.
If you do not want a prompt before deleting the directory and its contents, use the -rf flag.
Alternatively, head to the folder containing the files you want to delete, hit Shift + Right Click, and select Open a command window here. Then input "del [filename]" and press Enter.
The rm command is used to delete files.
You can delete the file by its inode number. see the output bellow:
alplab:~/cad# ls -il
63051 -rw-r--r-- 1 root root 0 Nov 12 11:48 ?
alplab:~/cad# find . -inum 63051 -exec rm -i {} \;
I used the "find" command to delete the file with the inode number 63051 (the inode belonging to my "?" file).
rm \?
and rm "?"
are both perfectly good ways to delete a file named ?
. If they didn't work, and you still seem to have a file name ?
, then it is most likely that the ?
being shown is not really a ?
, but rather the result of substituting an unprintable character with a ?
. To see what the file is really called (with GNU ls
) try:
ls --quoting-style=escape
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With