I cannot remove such file, I get error message. file name is
-?]d?j??.?
and I want to remove it. I try rm -?]d?j??.? but it gives error.
I cannot remove such file, I get error message. file name is
-?]d?j??.?
and I want to remove it. I try rm -?]d?j??.? but it gives error.
According to manual,
To remove a file whose name starts with a '-', for example '-foo', use one of these commands:
rm -- -foo
rm ./-foo
In you case enter:
rm -- -?]d?j??.?
or
rm -- '-?]d?j??.?'
First, look at the file with ls -b ./-*
to see the real filename. You can use bash
file completion to delete the file:
rm ./-
Followed by the TAB character.
Using the TAB will expand the funny characters in the filename just the way bash
wants to parse them.
rm
supports options, introduced by -
. When it sees your filename beginning with -
, it gets confused. Putting the name of the current directory ("./
") in front of the filename means the same file, but the name now starts with a .
, which doesn't confuse rm
.