The -i option (or --interactive) in the cp command prompts the user for confirmation before overwriting an existing file at the destination.
Purpose:
- Prevent Accidental Overwrites: This option helps avoid unintentional data loss by asking the user whether they want to proceed with the overwrite.
Example Usage:
cp -i source_file.txt destination_file.txt
If destination_file.txt already exists, the terminal will display a prompt like:
cp: overwrite 'destination_file.txt'?
You can then respond with y (yes) to overwrite or n (no) to skip the copy.
If you have any further questions or need more details, feel free to ask!
