LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 08-25-2005, 04:44 PM   #1
ghee22
LQ Newbie
 
Registered: Nov 2004
Posts: 16

Rep: Reputation: 0
hard link not working


i'm gonna try to make this as simple as possible
i'm trying to make a hard link from my .cshrc file to a sourceme.csh in different directory. when this works, i'll add other people's .cshrc file to be hard linked to sourceme.csh
as root i
Code:
ln sourceme.csh ../people/baxi/.cshrc
ls -l ../people/baxi/.cshrc
-rw-r--r--    2 root     root         2162 Aug 25 17:37 ../people/baxi/.cshrc
i edit sourceme.csh and prepend it with "freklja"
i save and exit. i edit sourceme.csh AGAIN just ot check if the changes were made, YES, they were.

i edit ../people/baxi/.cshrc and the changes are NOT preserved! I'm confused at this point. I've studied hard link & soft links through many LQ posts and it just doesn't work.

I tried symbolic links than by first removing my .cshrc file and then doing this

Code:
ln -s sourceme.csh ../people/baxi/.cshrc
ls -l ../people/baxi/.cshrc
lrwxrwxrwx    1 root     root           12 Aug 25 17:38 ../people/baxi/.cshrc -> sourceme.csh
i try to edit it and it say file exists but cannot be read... i open up a new terminal which reads people's baxi's .cshrc and nothing goes through!

i'm really confused about now.. this is all on RHEL Server 3. I'm actually SSHing into that machine through a RHEL WS 4 .
 
Old 08-26-2005, 04:11 PM   #2
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
when you give the relative location "sourceme.csh" for the symbolic link at "../people/baxi/.cshrc", it takes it as relative to the location of the link; i.e. it looks in "../people/baxi/sourceme.csh" which might not be what you want.

alternatively, you should either give an absolute path, or a relative path with respect to the location of the link. as a general rule, i usually create symlinks when i'm in the directory where the link will be; that way, i don't get confused about specifying the relative path of the source file
 
Old 08-30-2005, 12:38 PM   #3
ghee22
LQ Newbie
 
Registered: Nov 2004
Posts: 16

Original Poster
Rep: Reputation: 0
ok... i tried using an absolute path... it still doens't update /alpha/people/baxi when i update /alpha/software/.cshrc

is it because it's a regular file?
 
Old 08-30-2005, 01:04 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Depending on your editor, it may make a "backup" of the file first, which would ruin the hardlinking.

For symlinks, I would do:
Code:
cd /alpha/people/baxi
ln -s /alpha/software/sourceme.csh .cshrc
 
Old 08-31-2005, 11:52 AM   #5
ghee22
LQ Newbie
 
Registered: Nov 2004
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by Matir
Depending on your editor, it may make a "backup" of the file first, which would ruin the hardlinking.

For symlinks, I would do:
Code:
cd /alpha/people/baxi
ln -s /alpha/software/sourceme.csh .cshrc
i use emacs... what do you suggest and please don't say vi!

also, i tried symlink with absolute paths the way you wrote it and it still doens't point to same file.. maybe because of emacs as well?
 
Old 08-31-2005, 12:46 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
What does 'ls -l /alpha/people/baxi/.cshrc' show?

Does the link work before you try to edit the file?
 
  


Reply



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
how do I know if a file has a hard link to it? granny Linux - Newbie 13 04-04-2015 05:02 AM
cp: will not create hard link ????? taiwf Linux - Newbie 3 09-20-2005 06:56 PM
Soft Link and Hard Link Moataz Red Hat 1 04-25-2005 06:30 AM
Link/Applet not working in all Linux browsers, but working in IE MasterPatricko Linux - Software 6 09-04-2004 03:39 AM
hard link? linuxzouk Linux - Newbie 5 05-15-2004 12:20 AM

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

All times are GMT -5. The time now is 03:46 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
Open Source Consulting | Domain Registration