To move a file to another folder or directory, we can use the mv command followed by the source path of the file and then the destination path in Linux.
For example, let's say we have a file called myFile.txt which we need to move to a directory called myDirectory, to do that we can use the mv Linux command like this,
# Move "myFile.txt" to "myDirectory" directory
mv myFile.txt myDirectory
-
In the above command after the
mvcommand we have defined the source path of the file which is themyFile.txtand after that the destination path which is themyDirectorydirectory where the file needs to be moved to. -
Executing the above command will move the
myFile.txtfile to themyDirectorydirectory or folder.
See the execution of the above command live in repl.it.
That's all 😃!