cp command not overwriting

Dirty linux..

Well, it’s not as dirty as some, but my CentOS 5 install wouldn’t overwrite a bunch of files when I told it to cp -r source dest some files.

I discovered the alias command shortly after.

If you type simply alias at your shell, you’ll see a list of items returned as such:-

[root@localhost html]# alias
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’

Notice the alias cp=’cp-i’ .. yeah me too .. little sod.

To rid yourself of this forced interactive version of cp just type unalias cp and you’ll be granted your overwriting powers once more.

Nice

Advertisements

2 comments on “cp command not overwriting

  1. It’s the same as logging in as root – you should avoid it because it’s too easy to do something daft you don’t intend on.

    Rather than just disabling it, the workaround would be to use the full path to avoid the alias, as and when you need to: “/bin/cp -r “

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s