Welcome guest


mv - Move

The mv command is similar to the cp command. The mv command is used to move files from place to place on the file tree. It is also used to rename files on the file tree.

When used to move files around the file tree, mv is equivalent to copying the file and then removing the original. The original will no longer exist after the mv command is used.

Syntax

eos% mv source_path destination_path

Example 1

How would you rename the file oldstuff.txt to junk.txt if you were in your home directory?

Ask yourself:

Q: What am I doing? A: Renaming a file.
Q: How do I do that? A: Using the mv command.
Q: What are the path names? A: I am in my home directory. It is in my home directory and I am renaming it to junk.txt.

mv in the File Tree

Example 2

How would you move the file assignment in your home directory into MyE115?

Ask yourself:

Q: What am I doing? A: Moving a file on the file tree.
Q: How do I do that? A: Using the mv command.
Q: What are the path names? A: I am in my home directory. It is in my home directory and I am moving it to MyE115 which is also in my home directory.

mv in the File Tree 2

Be careful when using mv. Typos and small mistakes are potentially dangerous, and you may move the file to the wrong place.