• Home
  • Docker
  • Kubernetes
  • LLMs
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • Archived
Linux-Ubuntu | mv -- move files/directories
  1. Notes
  2. Examples
  3. Command Help (man mv)

  1. Notes

    target_file can be a file name, a directory (in this case the file will be moved to another directory), or a directory/file name (in this case the file will be moved to another directory and renamed).

    Moving a directory, will move the directory and all its contents.

    When moving files and directories, the inode number and timestamp of these files and directories are not changed.
  2. Examples
    • Moving file:
      • Move file1 from folder1 to folder2 (see bellow the options -i and -n to check if the destination file already exists).

      • Move file1 from folder1 to folder2 (renaming file1 to file2):
    • Renaming file:

    • Moving directory:

    • Renaming directory:

    • You can use both cp and rm commands to move files.
      First copy file1 from folder1 to folder2 and then delete file1 in folder1:
  3. Command Help (man mv)
    The following options can be used:
© 2025  mtitek