How do you move a file to a directory using the 'mv' command?

QuestionsQuestions8 SkillsProBasic Files OperationsAug, 05 2025
0187

To move a file to a directory using the mv command, follow these steps:

  1. Open your terminal.

  2. Use the mv command with the following syntax:

    mv /path/to/source_file /path/to/destination_directory/

Example:

If you have a file named example.txt in your current directory and you want to move it to a directory named documents, you would use:

mv example.txt documents/

Key Points:

  • Ensure the destination directory exists; otherwise, the command will fail.
  • You can also move multiple files at once by listing them before the destination directory.

Feel free to ask if you need more examples or clarification!

0 Comments

no data
Be the first to share your comment!