Posted By

beneberle on 07/16/10


Versions (?)

UNIX: move/rename files

 / Published in: Bash

The result of this command is that there is no longer a file called "oldfile", but a new file called "newfile" contains what was previously in "oldfile".

Like cp, the mv command also overwrites existing files. For example, if you have two files, fourthfile and secondfile, and you type the command

mv fourthfile secondfile 

mv will remove the original contents of secondfile and replace them with the contents of fourthfile. The effect is that fourthfile is renamed secondfile, but in the process secondfile is deleted.

  1. mv oldfile newfile

Report this snippet  

You need to login to post a comment.