Cp Command Problems Forcing Overwrite Using Cp Command
cp command problems forcing overwrite using cp command
cp, command, problems, forcing, overwrite, using, cp, command
Cp Command Problems Forcing Overwrite Using Cp Command
Post Description: cp command problems forcing overwrite using cp command
POST# 1041
Posted On: Fri Feb 29, 2008 12:01 pm
web hosting
Topic: 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



Share:
BBCODE:
HTML Code:


Fri Jan 25, 2008 3:39 pm
1
copy
Reply #1765
i recommend that isp's or unix systems with users who may be unfamiliar with unix setup the following aliases:

clr clear
cls clear
copy cp -i
del rm -i
delete rm -i
dir ls -alg
home cd ~
ls ls -f
md mkdir
move mv -i
pwd echo $cwd
type more

What do you think?

* name:  

* email:  

* Please enter comments:


Receive Replies on my Comments
(An email will be sent to you when someone replies to your comments)

Add image to comments
yes no             upload
     
  1. Cp: Cannot Create Symbolic Link
  2. Linux Shell Command - Cp Copy One Or More Files To Another Locatio
  3. Linux Cp Command How To Use Copy Command In Unix Systems
  4. Cp: Omitting Directory Linux Command Error
  5. Cp Command Problems Forcing Overwrite Using Cp Command
  6. Cp: Omitting Directory
  7. Cp: Omitting Directory - How To Fix