Nov 8, 2018

How to deal with cp: overwrite warning in Linux

Even you put "-f" or "--force" as option to your cp command, it may still prompt before overwrite.

This is because of alias:

# which cp
alias cp='cp -i'
/bin/cp

So to get rid of the prompt (make sure you know what you are doing), you can call cp directly by:

/bin/cp -f src dest

Or you can do

yes | /bin/cp -f src dest

which pipes a continuous stream of affirmatives into any command that gives you confirmation prompts.