LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-27-2007, 04:35 PM   #1
timrs
Member
 
Registered: Nov 2005
Location: MN, US
Distribution: openSuse 10.2
Posts: 93

Rep: Reputation: 15
ln -s Help (quick and simple)


Here is a quick and simple problem.
If I type
Code:
ln -s kaid kaid2
The command './kaid2' works fine. If I type
Code:
ln -s kaid /usr/bin/kaid
I end up with an error, the command 'kaid' now says command not found, and
Code:
cannot access `/usr/bin/kaid': Too many levels of symbolic links
 
Old 02-27-2007, 07:16 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Quote:
Originally Posted by timrs
Here is a quick and simple problem.
If I type
Code:
ln -s kaid kaid2
The command './kaid2' works fine. If I type
Code:
ln -s kaid /usr/bin/kaid
I end up with an error, the command 'kaid' now says command not found, and
Code:
cannot access `/usr/bin/kaid': Too many levels of symbolic links
it's

ln -s <target> <symbol>

not

ln -s <symbol> <target>

In other words, in your second example, you make a symbolic link called /usr/bin/kaid that links to something called "kaid" which would likely be in ./ and not really be anything. You should do:

ln -s /usr/bin/kaid kaid
 
Old 02-27-2007, 08:15 PM   #3
timrs
Member
 
Registered: Nov 2005
Location: MN, US
Distribution: openSuse 10.2
Posts: 93

Original Poster
Rep: Reputation: 15
Nope, you're backwards.
 
Old 02-27-2007, 08:24 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
From man ln:
ln [OPTION]... [-T] TARGET LINK_NAME (1st form)
ln [OPTION]... TARGET (2nd form)
ln [OPTION]... TARGET... DIRECTORY (3rd form)
ln [OPTION]... -t DIRECTORY TARGET... (4th form)

You make a link to a target---the target name always comes first---except #4 (which I do not understand)

In OPs 1st example, the order was target, link and the link worked

I think the problem has to do with using full pathnames in certain situations, but lets confirm with OP---where in fact is the target file? Is it possible that the first example worked because kaid2 is really the target?
 
Old 02-27-2007, 09:15 PM   #5
timrs
Member
 
Registered: Nov 2005
Location: MN, US
Distribution: openSuse 10.2
Posts: 93

Original Poster
Rep: Reputation: 15
Could you check if your right the next time you post? Its not that hard. I bet you $999999999999 you have this program (ln) too and are capable of checking yourself.
 
Old 02-28-2007, 12:59 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by timrs
Could you check if your right the next time you post? Its not that hard. I bet you $999999999999 you have this program (ln) too and are capable of checking yourself.
timrs;
Who is this addressed to? I suddenly find that I don't know what this thread is about. You posed a question--- Do you now have the answer?

If your post is saying that someone made a mistake, perhaps you should say what the mistake was......
 
Old 02-28-2007, 06:26 AM   #7
timrs
Member
 
Registered: Nov 2005
Location: MN, US
Distribution: openSuse 10.2
Posts: 93

Original Poster
Rep: Reputation: 15
No, sorry, but the command i have is correct... it works in the current directory, but when the link is in /usr/bin it doesn't work
 
Old 02-28-2007, 07:59 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
As I said in my other post, it has to do with specifying full path names. I just tried a few experiments.
If I link OUT of a folder, I needed to specify the full path name.
When in /opt:
ln -s vpnclient /home/mherring/Desktop does not work
whereas
ln -s /opt/vpnclient /home/mherring/Desktop DOES work

But if I am in /home/mherring/Desktop, I can do:
ln -s /opt/vpnclient vpnclient, and it works

And that's the truth........
 
Old 02-28-2007, 03:04 PM   #9
timrs
Member
 
Registered: Nov 2005
Location: MN, US
Distribution: openSuse 10.2
Posts: 93

Original Poster
Rep: Reputation: 15
Thankyou, this is strange though -- did the developers do this on purpose?
 
Old 02-28-2007, 03:20 PM   #10
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by timrs
Thankyou, this is strange though -- did the developers do this on purpose?
As opposed to what? accident? mistake?

No, I think there is probably a rational reason for it to be that way--but I have never seen it...

The really easy way to stay out of trouble is to always link IN, using the default link name:
ln -s /path/path/target
Automatically creates the link in the current directory with the name of "target"
 
Old 03-03-2007, 03:47 PM   #11
timrs
Member
 
Registered: Nov 2005
Location: MN, US
Distribution: openSuse 10.2
Posts: 93

Original Poster
Rep: Reputation: 15
I think its because when ln -s 1 /dir/2 is made, the file /dir/2 is literally linked to 1, and there is no 1 in the directory 2 is in -- thats the best I can explain it
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick and simple question please! lonecrow Linux - Software 13 11-15-2005 08:38 AM
Quick simple KDE question dangerousdave Linux - Newbie 1 03-29-2005 12:33 PM
Quick Simple Question Oracl3 Linux - Newbie 4 04-05-2004 08:40 PM
simple, quick question.. b0uncer Linux - Hardware 4 12-28-2003 12:34 PM
Quick Simple Q - repeated programs Nerd2 Linux - Software 2 05-30-2003 06:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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