How to move directories?

QuestionsQuestions8 SkillsProBasic Files OperationsAug, 05 2025
0178

To move directories in Linux, you can use the mv command just like you would for files. Here’s how to do it:

Syntax

mv /path/to/source_directory /path/to/destination_directory/

Example

If you want to move a directory named myfolder to another directory called backup, you would use:

mv myfolder backup/

Moving Multiple Directories

You can also move multiple directories at once by listing them before the destination:

mv dir1 dir2 dir3 /path/to/destination/

Important Notes

  • If the destination directory does not exist, the mv command will rename the source directory to the name specified as the destination.
  • Ensure you have the necessary permissions to move the directories.

Further Learning

For more details, you can check the manual page by running man mv in the terminal. If you have any more questions or need clarification, feel free to ask!

0 Comments

no data
Be the first to share your comment!