InMotion Hosting Support Center

Moving or renaming files can be accomplished with the mv command.

Command: mv
Synopsis: mv [OPTION]... [-T] SOURCE DEST

Below is a list of the options that can be used with the mv command. You can use more than one at a time by stacking them.

Option Long Name Description
--backup[=CONTROL] Make a backup of each existing destination file.
-b Like --backup but does not accept an argument.
-S -suffix=SUFFIX Override the usual backup suffix./td>
-t --target-directory=DIRECTORY Move all SOURCE arguments into DIRECTORY
-T --no-target-directory Treat DEST as a normal file.
-u --update Performs the move only when the SOURCE file is newer than the destination file or when the destination file is missing.
-v --verbose Displays an explanation of what is being done.
--help Display this help and exit.
--version Output version information and exit.


Renaming a file When renaming a file in the same directory, no directory information is included. The only parameters needed are the old and new file names. Below we rename the original oldtext.txt file to newtext.txt.

mv oldtext.txt newtext.txt

Moving a file to another directory In this example we are moving the file somefile.txt to a subfolder named level2. The second parameter includes the relative path as well as the file name.

mv somefile.txt level2/somefile.txt

Moving to another folder while renaming This example is much like the example above, but we are also renaming the file as it is moved. The second parameter includes the destination folder as well as the new name.

mv somefile.txt level2/newname.txt

Was this article helpful?

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

0 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!