Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » CommandsRSS Feeds

Move or Rename file and directories - mv

Posted By: Tilly Hughes     Category: Unix / Linux / Ubuntu     Views: 3000

This article explains about mv command with an example in unix.

mv command is used to move or Rename file and directories in unix.

Syntax of mv Command

mv [- option] oldFileName newFileName 

Most Commonly used options are :
  • -f mv will move the file(s) without prompting even if it is writing over an existing target. Note that this is the default if the standard input is not a terminal.
  • -i Prompts before overwriting another file.

Examples of mv Command

Example 1 : Move file1 to new or existing file

mv file1 new_file

Example 2 : Move file1 to existing directory

cp file1 destination_directory

Example 3 : Rename a file in the current directory

mv old_filename new_filename
  
Share: 


Didn't find what you were looking for? Find more on Move or Rename file and directories - mv Or get search suggestion and latest updates.

Tilly Hughes
Tilly Hughes author of Move or Rename file and directories - mv is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!