You can use standard UNIX/Linux rm command. All you have to do is instruct the rm command not to follow end of command line flags by passing double dash -- option before -foo file name.
Many user creates these kind of file accidentally with dashes. If you attempt to remove such file via rm command, UNIX and Linux will attempt to use them as command-line options and the command will display out with an error. So how do you get rid of these files and delete them on a UNIX?
rm command syntax
Use rm command to remove files or directories as follows:
rm -- -foo
Other options: Unix remove file with dash
Some more options remove the ---- Dashes ---- on a Unix-like system:
rm ./-Foo rm "./---bar" rm -- -F rm -- ---footbal ## Edit file ## vi "./--foo"Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?