Moving or Renaming a File with mv

Moving and renaming a file are the same thing. It doesn’t matter whether you are moving the directory to another or from one filename to another filename in the same directory; there is only one command to remember. To move a file named testfile from ~/Documents to~/Downloads, use this command:

If the destination is not exist, the testfile will be rename to destination name.

Assuming that you are the user hadi, to rename a file that is in your current directory, you could use the following:

To rename a file as you move it fomr ~/Documents to ~/Downloads, you could use this:

Or from anywhere using an absolute path, you could use the following command:

Or from anywhere using a path shortcut, you could use this:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s