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: