Unix: Files starting with a dash, -

Solution 1:

You need to use the keyword -- to tell the mv command that the arguments are not to be interpreted as options. Watch:

$ mv -N1.ext x-f1.ext
mv: invalid option -- N
Try `mv --help' for more information.

$ mv -- -N1.ext x-f1.ext
$ ls
x-f1.ext

Use -- after all the options on the commandline. Eg, if you're trying to use the -i option to mv, it would go before --:

mv -i -- -filename-begins-with-dash newfilename

Solution 2:

Another technique is to include the parent directory with the file name...

To rename the file -file-to-rename to file-to-rename...

mv  ../parent-dir/-file-to-rename  file-to-rename

Credit to @Skippy le Grand Gourou for confirming that ./-file-to-rename works with mv and rm as in...

mv  ./-file-to-rename  ./--file-to-rename
    
rm  ./-file-to-rename