What does the -i option for the mv command do?

The -i option for the mv command stands for "interactive." When you use this option, it prompts you for confirmation before overwriting an existing file in the destination.

Key Features:

  • Prevents Accidental Overwrites: If the destination file already exists, you will receive a prompt asking if you want to overwrite it.
  • User Control: You can choose to proceed with the overwrite by typing y (yes) or cancel the operation by typing n (no).

Example:

If you run the command:

mv -i file.txt destination/

And if destination/file.txt already exists, you will see a prompt like:

mv: overwrite 'destination/file.txt'?

Using the -i option is a good practice when you want to ensure that you do not accidentally overwrite important files.

0 Comments

no data
Be the first to share your comment!