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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-07-2002, 02:40 PM
|
#1
|
Member
Registered: Dec 2001
Posts: 195
Rep:
|
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.
|
|
|
11-07-2002, 02:43 PM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
just use "ln -sf /Apache.... /usr....."
|
|
|
11-07-2002, 02:46 PM
|
#3
|
Member
Registered: Dec 2001
Posts: 195
Original Poster
Rep:
|
Thanks Ill try that. I was missing the -sf lingo :-)
|
|
|
11-07-2002, 02:47 PM
|
#4
|
Senior Member
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Mostly Debian based systems
Posts: 4,368
Rep:
|
man ln should have helped...
|
|
|
11-08-2002, 06:54 PM
|
#5
|
Member
Registered: Dec 2001
Posts: 195
Original Poster
Rep:
|
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.
|
|
|
11-08-2002, 06:59 PM
|
#6
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
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.
|
|
|
11-08-2002, 07:15 PM
|
#7
|
LQ Newbie
Registered: Jul 2002
Location: Norway
Distribution: Slackware 8.1
Posts: 20
Rep:
|
Can't you just remove the existing link and create a new one with ln?
|
|
|
11-08-2002, 07:42 PM
|
#8
|
Member
Registered: Dec 2001
Posts: 195
Original Poster
Rep:
|
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...
|
|
|
11-08-2002, 10:12 PM
|
#9
|
Member
Registered: Apr 2002
Distribution: Gentoo 2006.0 AMD64
Posts: 399
Rep:
|
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
|
|
|
11-09-2002, 01:52 PM
|
#10
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
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.
|
|
|
All times are GMT -5. The time now is 06:53 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|