How to move a directory to another folder or directory in Linux?

Published July 25, 2021

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 is directory1 and after that the destination path which is directory2 directory where it needs to be moved to.

  • Executing the above command will move the directory1 directory to the directory2 folder.

See the execution of the above command live in repl.it.

That's all 😃!

Feel free to share if you found this useful 😃.


Share on: Facebook Twitter