-3

Everywhere I read the following description.

-i, --interactive :::::::Before overwriting an existing file, prompt the user for confirmation. If this option is not specified, cp will silently overwrite files.

but I am not able to understand why the term overwriting is used here. If I am copying a directory to another directory, then what is overwriting here?

Somebody please explain me the use of cp -i with an example.

xscorp7
  • 127
  • 2
    this sounds like a homework question. regardless, just try it, cp a file to somewhere new, or where it already exists... – guiverc May 06 '18 at 05:14

1 Answers1

2

The word overwriting is used while we are copying a file/folder to somewhere it already exist. Lets say we have two folders folder1 and folder2, each one of them containing a file named file.txt So, if we try to copy the contents of folder1 to folder2 using cp -i command, it will ask us to confirm overwriting because the same file already exist there.

xscorp7
  • 127