Computer Hope

Other Pages

Home
Site map
Computer help

Dictionary
News
Q&A
What's new

Tools

E-mail this page
Print Preview
Edit this page




Reference number: CH000651

How do I rm or mv a file that begins with a dash?

Question:

How do I rm or mv a file that begins with a dash?

Answer:

Files that begin with a hyphen (dash) can be tricky to remove because Linux or Unix will interpret the character after the dash as an option. For example, if the user attempts to type the below command they would receive the error also shown below.

mv -myfile.txt myfile.txt
mv: invalid option -- m
Try `mv --help' for more information.

In the above example the operating system is interpreting the -m as a switch. For this command to work you must type the below command.

mv ./-myfile.txt myfile.txt

Typing this command will rename the file in the current directory and will cause Linux or Unix to not notice the dash.

 

 

 

Index


Category:
Linux Q&A

Companies:
Click here

Related Pages:

Resolved

Were you able to locate the answer to your questions?

Home - Computer help - Contact - Dictionary - Links
Link to Computer Hope - Bookmark Computer Hope