Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know how I would turn off the interactive mode when using cp?

I am trying to copy a directory recursively into another and for each file that is getting overwritten I have to answer 'y'.

The command I am using is:

cp -r /usr/share/drupal-update/* /usr/share/drupal

But I get asked to confirm each overwrite:

cp: overwrite `./CHANGELOG.txt'? y  
cp: overwrite `./COPYRIGHT.txt'? y  
cp: overwrite `./INSTALL.mysql.txt'? y  
cp: overwrite `./INSTALL.pgsql.txt'? y  

I am using ubuntu server version jaunty.

share|improve this question
Removing the alias is typically "unalias". It is also a bad idea to change the question, as the answers no longer makes sense. – pehrs Mar 6 '10 at 18:26
I agree that it is a bad idea to change the question - but the question was never changed - I just added tags. – Faisal Vali Apr 17 '10 at 2:49
Personally I'm such a huge fan of rsync that I tend to use it even when copying files around locally. OK, not when I have only a simple copy operation ahead, but during larger transfers, yes. Why? Because rsync has great versatility when it comes to recursive transfers, dry runs, including/excluding, preserving various permissions, continuing interrupted operations and so on. – Janne Pikkarainen Aug 3 '10 at 6:02
up vote 33 down vote accepted


alias cp

To see if cp has been aliased to cp -i

In that case run:

\cp -r /usr/share/drupal-update/* /usr/share/drupal 

to ignore the alias

share|improve this answer
Thanks - that did it :) – Faisal Vali Mar 6 '10 at 17:11
I would suggest finding where the alias was made and removing it... hopefully they put it in a local file. This hand holding is on my reasons for not using *buntu – xenoterracide Aug 3 '10 at 6:11
This is an old thread, but Ive upgraded to Fedora 19, and this happened to. Someone defaulted an alias for cp – user208113 Feb 4 '14 at 19:50
To use the original command, rather than the ailas, use command cp ... – ltn100 Jan 5 at 10:42
You can also do an unalias cp in that case. – Dominique Apr 1 at 7:51

cp -f will not ask for confirmation (that's force) So do

cp -fr /usr/share/drupal-update/* /usr/share/drupal
share|improve this answer
cp -fr is still asking for confirmation :( – Faisal Vali Mar 6 '10 at 16:18
--remove-destination maybe? – TonyUser Mar 6 '10 at 16:26
--remove-destination can indeed help in that case. It's typically an access rights problem if it's needed. – pehrs Mar 6 '10 at 16:34
cp -fr still asks for confirmation if it has an alias with interactive: "alias cp='/bin/cp -i'". You either need to unalias cp: "unalias cp" or you can run without the alias using \: "\cp -r /bla/ /foo/". See Duane's answer above. – andrei Oct 24 '12 at 13:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.