How to move files in Linux?

QuestionsQuestions8 SkillsProBasic Files OperationsNov, 25 2025
090

To move files in Linux, you can use the mv command followed by the source file(s) and the destination directory or new filename. Here’s how to do it:

Moving a Single File

To move a single file to a different directory:

mv filename.txt /path/to/destination/

Moving Multiple Files

To move multiple files at once, specify the files followed by the destination directory:

mv file1.txt file2.txt /path/to/destination/

Renaming a File

To rename a file, specify the current filename and the new filename:

mv oldname.txt newname.txt

Example

  1. Move a file named report.txt to a directory called documents:

    mv report.txt documents/
  2. Move all .jpg files to a directory called images:

    mv *.jpg images/
  3. Rename notes.txt to archive.txt:

    mv notes.txt archive.txt

Make sure you have the necessary permissions to move the files and that the destination directory exists.

0 Comments

no data
Be the first to share your comment!