Avoid Confirmation while Copying Files

While copying files, using cp command you would have noticed that it always asks for the confirmation overwriting files like below.

[root@server ~]# cp -v test.txt example.txt
cp: overwrite ‘example.txt’?

Will see how you can avoid that – but before that let’s see why it happens.

This happens because of alias set in the .bashrc file.

[root@server ~]# cat .bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

you can remove alias in .bashrc file – and you won’t be asked for confirmation ever again.

but if you want to skip confirmation for time being then you can call the cp command directly from bin – Example.

[root@server ~]# /bin/cp -v test.txt example.txt
‘test.txt’ -> ‘example.txt’
[root@server ~]#

Leave a Reply

Your email address will not be published. Required fields are marked *