This question already has an answer here:
After a mistake in a script I ended up with a file whose name starts with a dash '-'
-myfile.txt
I tried so far :
rm -myfile.txt
rm: illegal option -- m
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
rm "-myfile.txt"
rm: illegal option -- m
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
rm "\-myfile.txt"
rm: \-myfile.txt: No such file or directory
rm \-myfile.txt
rm: illegal option -- m
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
rm "-"myfile.txt
rm: illegal option -- m
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
Do you have any idea ?
Thanks
Thanks to @ajp15243 : the answer is :
or
you could always try the inode solution :
and
2116530
is the inode of the file. Then you can use find to delete itor even
Use the absolute pathname
Like rm /home/name/-myfile.txt
try this one put your file name in "-" eg: rm "-myfile.txt"