redhat.com | Tips and Tricks Copy Command

Solution: To change this behavior, edit the /root/.bashrc file and comments out or remove the alias line that adds the -i argument to the cp command:# alias cp=cp -iThe changes should take affect when a new user session is started or the /root/.bashrc file has been sourced in the current session.Update:Several astute readers mailed us with refinements for this response. Heres what they had to say:Theres a reason why cp is aliased to cp -i in _roots_ .bashrc and .cshrc/.tcshrc .cshrc and .tcshrc are not mentioned in the original response. After all, do you really want root to be able to overwrite a file without checking?There is a way around the problem that retains the copy protections in roots shell. Heres how:$ \cp -f <filename> <path/to/existing_file>Backslashing the command temporarily avoids the alias done in the shell but does not permanently remove the protection.$ aliasalias cp=cp -i [snip other aliases]$ cd /tmp$ touch test$ touch test2$ cp test test2cp: overwrite `test2? n$ cp -f test test2cp: overwrite `test2? n$ \cp test test2$Thanks to all our readers who mailed in with comments and corrections on this point.

via redhat.com | Tips and Tricks.

Comments

Popular posts from this blog

Austin Friends and places

PHP Web Store

Looking for another camera.