LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-18-2005, 06:46 PM   #1
sausagejohnson
Member
 
Registered: Mar 2004
Location: Canberra Area, Australia
Distribution: Kubuntu
Posts: 242

Rep: Reputation: 30
cp and symbolic links?


Noticed a difference in behaviour between fedora and gentoo using the cp command over symbolic links and hoping someone can explain why...

My /etc/localtime file is a symbolic link back to --> /usr/share/zoneinfo/Australia/Sydney

In the two operating systems, I issue a: cp /usr/share/zoneinfo/Australia/Adelaide /etc/localtime

FEDORA:
The Adelaide file overwrites the localtime file.

GENTOO:
The Adelaide file overwrites the file that /etc/localtime is pointing to, in this case, /usr/share/zoneinfo/Australia/Sydney becomes a copy of Adelaide.

Can anyone explain why and tell me what switches I need that will force an overwrite, deleteing the old symbolic link and writing Sydney as the new /etc/localtime file (no longer being a symbolic link)?
 
Old 07-19-2005, 12:55 AM   #2
mhallbiai
Member
 
Registered: Jun 2005
Posts: 96

Rep: Reputation: 16
to see what switches are used (FC) type: alias
and compare to gentoo

hope this helps
 
Old 07-19-2005, 01:17 AM   #3
sausagejohnson
Member
 
Registered: Mar 2004
Location: Canberra Area, Australia
Distribution: Kubuntu
Posts: 242

Original Poster
Rep: Reputation: 30
Ah........ reveals some info. Thank you.

Fedora has cp as 'cp -i'
Gentoo has nothing

To me this means the only difference is that Fedora will force you to select (Y/N) to an overwrite.

Other than that, the behaviour should not be different. Handy util though.
 
Old 07-19-2005, 01:25 AM   #4
mhallbiai
Member
 
Registered: Jun 2005
Posts: 96

Rep: Reputation: 16
i have no experience with gentoo other than watching friends start the compile...

there is a -d switch in 'man cp' which says:
Quote:
-d same as --no-dereference --preserve=link
--no-dereference
never follow symbolic links
--preserve[=ATTR_LIST]
preserve the specified attributes (default: mode,ownership,timestamps) and security contexts, if possible additional attributes:
links, all
so maybe trying: cp -d /usr/share/zoneinfo/Australia/Adelaide /etc/localtime

hope this helps
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Symbolic Links petercool Linux - General 2 08-20-2003 11:15 AM
Symbolic links bkmesenbrink Linux - Newbie 2 11-13-2002 11:54 AM
Symbolic links pdstatha Programming 1 04-08-2002 09:50 PM
symbolic links winger Linux - General 5 04-06-2002 05:16 PM
Symbolic links Valerie Linux - Newbie 12 03-31-2002 01:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:25 AM.

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
Open Source Consulting | Domain Registration