If you want to move a file that starts with a dash (-
), you can use the following command:
mv -- -filename destination
The double dash --
tells the mv
command that there are no more command line options, and that the remaining arguments are file names.
For example, if you want to move a file named -file.txt
from the current directory to the directory /tmp
, you would run:
mv -- -file.txt /tmp
This will move the file -file.txt
to the directory /tmp
.