LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-02-2007, 07:37 PM   #1
hocheetiong
Member
 
Registered: Jul 2007
Location: Penang , Malaysia.
Distribution: red hat linux
Posts: 133

Rep: Reputation: 15
Smile cp -f command diffrence between rhle3 &rhle4?


I want to using command cp to copy a file, last time i am using rhle3, i can use command cp -f to copy a file without askking me "the files is existing,do you want to overwrite". Now i am using rhle4 than i dont want system to prompt asking me want to overwrite the same files or not.I want to overwrite the file, i dont want system prompt to asking me again.

Thank you.
 
Old 10-03-2007, 06:17 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Make sure cp isn't aliased on one or the other machine - run this command on both:
Code:
alias cp
Probably on one machine has cp aliased to "cp -i". You need to find where the alias is set and comment out / delete that alias. Typical places where aliases are set:
  • ~/.bashrc
  • ~/.bash_profile
  • ~/.profile
  • ~/.bash_aliases ~/.aliases or something similar.
Assuming you're using bash as your shell the first three will be checked when you start a log in shell. Often aliases are split out into a separate file which is called from one of the first three files, hence the name of an aliases file if present is not certain - it depends what the author of the main file decided would be nice.

A quick way to try to find the alias:
Code:
cd ; grep 'alias cp' .bash* .profile .*alias*
 
Old 10-03-2007, 06:42 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Indeed on RHEL4 cp is aliased to "cp -i" by default and only for root. After checking as suggested by matthewg42, you have the choice to remove the alias or escape it by preceding the command with a backslash
Code:
\cp -f somefile somedir
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Upgrade from 2.6.9-5.EL to 2.6.15 RHLE4 mavv Linux - Kernel 1 08-11-2006 05:24 PM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-28-2006 12:57 AM
whats new with RHLE4 dabash Linux - Certification 2 03-31-2006 05:23 AM
; && -- questions... whats the diffrence?? trey85stang Linux - Newbie 2 05-12-2004 02:32 PM
Diffrence nfs & telnet,ssh etc... tkmuthuvel Linux - Networking 2 08-03-2003 10:16 PM


All times are GMT -5. The time now is 12:34 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration