Forrest logo
back to the mv tool

mv:tldr:6bf66

mv: Prompt for confirmation before overwriting existing files, regardless of file permissions.
$ mv -i ${path-to-source} ${path-to-target}
try on your machine

The command mv -i ${path-to-source} ${path-to-target} is used to move a file or directory from a source location to a target location.

Here is a breakdown of the command:

  • mv: mv is short for "move". It is a command used in Linux and Unix-like operating systems to move files and directories.

  • -i: The -i option stands for "interactive". When this option is used, the command prompts the user for confirmation before overwriting an existing target file. This is useful to prevent accidental overwriting of files.

  • ${path-to-source}: This is a placeholder for the actual path to the source file or directory that you want to move. You need to replace ${path-to-source} with the actual path, for example: /home/user/file.txt or /path/to/directory.

  • ${path-to-target}: Similar to ${path-to-source}, this is a placeholder for the actual path to the target location where you want to move the file or directory. Replace ${path-to-target} with the actual path, for example: /home/user/newfile.txt or /path/to/newlocation.

By running this command, the file or directory located at ${path-to-source} will be moved to ${path-to-target}. If a file with the same name already exists at the target location, it will prompt for confirmation before overwriting the existing file (due to the -i option).

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mv tool