Wallpapers Forums Login

Cp Command Problems Forcing Overwrite Using Cp Command

today i was trying to copy a many files and when i send this command: Command:
cp -rf /this/file /to/this/file
i get this prompts: Command:
cp: overwrite '/this/file /to/this/file' ?
when i look at the man pages for cp it says:
-f, --force
              if an existing destination file cannot be opened, remove it  and
              try again
so it shouldn't ask me, so i found out that de defaults on the dedicated linux server we got from www.webune.com has cp as alias. so if you having this same problem, then run this command to see your alias: Command:
alias
OUTPUT:
alias cp='cp -i' alias l.='ls -d .* --color=tty' alias ll='ls -l --color=tty' alias ls='ls --color=tty' alias mv='mv -i' alias rm='rm -i' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
as you can see, i do have an alias with cp so how do you overwrite without prompt? what i need to do is remove that cp alias witht he unalias command so i send this coommand: Command:
unalias cp
so now when you do the alias command, you wont see the cp alias anymore so what happens if your not the admin or dont have access to root, then you can run an unaliased cp command, try Command:
$ /bin/cp -rf /this/file /to/this/file
hope this helps.. thanks for the guys at www.webune.com for their support on this question
Praxis Sat Apr 21, 2012
Yet another customer served, the '\cp -f' option worked a charm on Debian.
meh Mon Dec 05, 2011
love the layout of your instructions. clear and concise!
Frank Thu Nov 17, 2011
You da man!!!!
Ms Wed Nov 16, 2011
Great information, Thank you!!
Georg Mon Oct 17, 2011
Thanks it helped!
talha Wed Aug 10, 2011
it worked thank you for your sharing
John Wed Aug 10, 2011
I know this topic is old but you can also use 'cp'.
Mamun Wed Aug 11, 2010
I want to dont show overwrite commend for cp.

So what i do now.

Overwrite?
maggo Mon Apr 12, 2010
- at - g33kinfo

the command

\cp -rf /this/file /to/this/file

doesn't work on my machinse centos 5.4

any ideas?
g33kinfo Tue Mar 16, 2010
you can also add a \ in front of the command to temporarily disable the alias...

\cp -rf /this/file /to/this/file

g33kin
Oleg Mon Mar 15, 2010
Thanks a lot! I've been wondering why would it ask me all the time to overwrite or not to overwrite the file. I had the same alias so thanks a lot again for the tip!
os3009 Mon Jan 25, 2010
thanks.. very useful tip
i tried every step and worked fine
Sia Tue Nov 03, 2009
nice one, thanks for that. pretty sure debian doesn't have tha alias by default. i'm kinda new to centos, and this was bothering me.
Fletch Mon Jun 01, 2009
or

yes n | cp -rf
Dany Mon Mar 16, 2009
or you can use \ in front of cp -f <source> <destination> command which will temporarly disable the alias.

Related Content

Information

Share

wallpaperama | Wallpapers | Forums | Terms Of Service

copyright © 2013 wallpaperama - All Rights Reserved - Last Updated Mon May 06, 2013 (-8 GMT)
Powered by: Webune Forums V5