UNIX: move/rename files

/ Published in: Bash
Save to your folder(s)

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.

Copy this code and paste it in your HTML
  1. mv oldfile newfile

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.