To move a directory to another folder or directory, we can use the mv
command followed by the source path of the directory and then the destination path in Linux.
For example, let's say we have a directory called directory1
with some files inside it which we need to move to a directory called directory2
, to do that we can use the mv
Linux command like this,
# Move "directory1" to "directory2" directory
mv directory1 directory2
-
In the above command after the
mv
command we have defined the source path of the directory which isdirectory1
and after that the destination path which isdirectory2
directory where it needs to be moved to. -
Executing the above command will move the
directory1
directory to thedirectory2
folder.
See the execution of the above command live in repl.it.
That's all 😃!