LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-01-2012, 12:53 PM   #1
kitek
Member
 
Registered: Apr 2005
Posts: 252

Rep: Reputation: 15
help with cp to overwrite contents


I am using
Code:
cp -Rf source dest
And it still asks me to confirm each file. By looking at man, it looks like I am doing it write. I am trying to copy a directory's contents including sub directory's. There is 100's of files. I must be doing something wrong.

Centos 6.2
 
Old 05-01-2012, 01:46 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
By default cp does NOT prompt for overwrite. If you use the "-i" interactive option it does prompt.

This suggests to me that you likely have cp aliased so that it always adds the -i option.

Type "alias" to see defined aliases and see if cp appears in the list.

To turn off the alias you can run "unalias cp". To turn it off permanently you'd have to find whatever file (typically /etc/bashrc, /etc/bashprofile, $HOME/.bashrc or $HOME/.bash_profile) that sets it and comment out or remove the alias.
 
Old 05-01-2012, 02:24 PM   #3
kitek
Member
 
Registered: Apr 2005
Posts: 252

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by MensaWater View Post
By default cp does NOT prompt for overwrite. If you use the "-i" interactive option it does prompt.

This suggests to me that you likely have cp aliased so that it always adds the -i option.

Type "alias" to see defined aliases and see if cp appears in the list.

To turn off the alias you can run "unalias cp". To turn it off permanently you'd have to find whatever file (typically /etc/bashrc, /etc/bashprofile, $HOME/.bashrc or $HOME/.bash_profile) that sets it and comment out or remove the alias.
That did it. I use very little so I will just unalias it when needed. However, that's good to know though so I know what to do in the future when that needs to be done and with other commands too.
 
Old 05-01-2012, 02:24 PM   #4
glamiss
LQ Newbie
 
Registered: May 2012
Location: minneapolis
Distribution: rhel 3/4 (soon to add 5)
Posts: 9

Rep: Reputation: Disabled
you can also use a backslash in front of a command to use the unaliased version of it, such as \cp, \rm, etc etc
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you overwrite the contents of a file without changing the file size? lothario Linux - Software 3 07-13-2010 08:43 AM
why does X overwrite my rc.keyb? stabu Slackware 5 10-22-2009 01:15 AM
list contents of directory without listing contents baddah Linux - Newbie 2 06-12-2006 04:02 AM
Copy and Overwrite jrdioko Linux - Newbie 2 06-29-2004 11:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration