Working with Files - mv Assignment Help

Assignment Help: >> Unix Files and Directories - Working with Files - mv

mv

There are several examples where a file might have to be moved from one directory to another: The mv command permits for the movement of files in UNIX. The mv command could be used for three purposes:

  • To rename a file with a new name
  • To move one or further files to a different directory
  • Rename a directory by a new directory name

Syntax

First Form

mv file1           file2

In the syntax file1 is the old filename and file2 is the new name

Second Form

mv file1 file2 ..... d1

In the syntax file1, file2, .... are the names of the files to be moved and d1 is the destination directory

Third Form

mv d1 d2

In the syntax d1 is the old directory name and d2 is the new directory name.

In the given example the files file1, file2 are moved to the directory newpersonal.

# mkdir newpersonal

# mv file1 file2 newpersonal

Note : The new and the old files might have the similar names provided they reside in variant directories. If the name of the new file is the similar as in which of an existing file there contents are lost.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd