Can I move directories?

QuestionsQuestions4 SkillsProBasic Files OperationsSep, 27 2025
0126

Yes, you can move directories using the mv command in Linux. The syntax is the same as moving files.

Example:

If you have a directory named my_folder that you want to move to another directory called target_directory, you would use the following command:

mv my_folder target_directory/

Breakdown of the command:

  • mv: The command used to move files and directories.
  • my_folder: The name of the directory you want to move.
  • target_directory/: The destination directory where you want to move my_folder. The forward slash indicates that it's a directory.

Make sure to replace my_folder and target_directory/ with your actual directory names. If you want to rename the directory while moving it, you can specify a new name in the destination path.

0 Comments

no data
Be the first to share your comment!