How to deal with the “copy” command when someone aliases it

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com

I just had this exact problem, and the solution is good to know:

cp is non-interactive by default so a lot of people, myself included, set an alias to include the -i flag so that cp was interactive by default.

alias cp=cp -i
But I used to enjoy the fact that if I set this alias it would prompt me when overwriting files but if there was a situation where I wanted it to be non-interactive I could do that by specifying -f. Basically, the last -i or -f would win. I want interative by default but the ability to specify non-interactive at my discretion.

However, recently or so, I noticed that several linux distributions include a cp that if you specify a cp -i alias you cannot specify -f to use non-interactive mode. The -f is ignored or at least doesn’t cancel out the -i. Perhaps there is another way do to what I want but I’m unaware of it at the moment. Currently I have to remove the alias, do the non-interactive copy, and then reinstate the alias. Super annoying.

Update: You can bypass an alias by putting quotes around the command like so,

“cp” source destination

Source