The default cp command on Linux is aliased (alias cp=’cp -i’) and cannot be overwritten on copy, even if you use -f

To view

alias cp
Copy the code

According to

alias cp='cp -i'
Copy the code

The solution

  1. Modify cp instruction
alias cp='cp'
cp -rf /test/a
Copy the code
  1. Cancel cp alias (rest assured this is not permanent) :
unalias cp
cp -rf /test/a

Copy the code
  1. Run the cp command without alias: (Note: recommend this method!)
\cp -rf /test/a
Copy the code
  1. Another interesting method:
yes|cp -rf /test/a
Copy the code