LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-07-2002, 02:40 PM   #1
ForumKid
Member
 
Registered: Dec 2001
Posts: 195

Rep: Reputation: 30
How to relink a file


Hi,
Currently this is my situation.
I have a file in /Apache/bin called jdk. It points/links to /usr/local/jdk. I need to update my jdk so now in /usr/local/ will be jdk1. So i want to create a link in /Apache/bin called jdk1 and have it link to /usr/local/jdk1..

Does this make sense. I think its quite easy. I have been messing around with ln but not sure that is the correct way to do it.
Thanks as always.
 
Old 11-07-2002, 02:43 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
just use "ln -sf /Apache.... /usr....."
 
Old 11-07-2002, 02:46 PM   #3
ForumKid
Member
 
Registered: Dec 2001
Posts: 195

Original Poster
Rep: Reputation: 30
Thanks Ill try that. I was missing the -sf lingo :-)
 
Old 11-07-2002, 02:47 PM   #4
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Mostly Debian based systems
Posts: 4,368

Rep: Reputation: 64
man ln should have helped...
 
Old 11-08-2002, 06:54 PM   #5
ForumKid
Member
 
Registered: Dec 2001
Posts: 195

Original Poster
Rep: Reputation: 30
HI,
I still cant get it to work
I do ln -sf and it doesnt change the existing link.
Its a directory to directory link. I even tried ln -sfd. It doesnt report errors and yet doesnt work...

Any ideas.
 
Old 11-08-2002, 06:59 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you want to be very very careful about linking directories, as if you have a trailing / then it will create a link INSIDE the directory, not over the top of it, which can get you in a right state.
 
Old 11-08-2002, 07:15 PM   #7
Bojdom
LQ Newbie
 
Registered: Jul 2002
Location: Norway
Distribution: Slackware 8.1
Posts: 20

Rep: Reputation: 0
Can't you just remove the existing link and create a new one with ln?
 
Old 11-08-2002, 07:42 PM   #8
ForumKid
Member
 
Registered: Dec 2001
Posts: 195

Original Poster
Rep: Reputation: 30
Hi,
I did not know about the trailing slash, although i just entered like this

ln -sf /Apache.. /jdk

f should force so there should be no need to remove the link. Something is not right...
 
Old 11-08-2002, 10:12 PM   #9
Grim Reaper
Member
 
Registered: Apr 2002
Distribution: Gentoo 2006.0 AMD64
Posts: 399

Rep: Reputation: 30
the way that ive always created a new link is by removing the old one with rm -rf and then recreating the link with ln...why not just do it this way? it works, and its not like there is downtime for this particular service...maybe a split second, depending on how fast you can type
 
Old 11-09-2002, 01:52 PM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you remove a link with the rf flags? that's very dumb. if you accidentally descend into the linked directory, you can just delete it all.
 
  


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
forrtl: severe (47): write to READONLY file, unit 5, file /dev/pts/1 terrence Programming 1 10-01-2005 11:22 PM
awk: fatal:cannot open file for reading (no such file or Directory) in Linux sangati vishwanath Linux - Software 4 07-06-2005 01:59 AM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 04:15 AM
Yum update complains missing file (broken dep), but file can be located. davidas Linux - Software 0 03-27-2004 10:11 PM
How to play a media file/ video file/mp3 file recorded in harddisk/cd-rom arindam Linux - Newbie 2 09-05-2003 11:31 AM

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

All times are GMT -5. The time now is 06:53 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