[mdlug] Painfully simple ln -s command question

Aaron Kulkis akulkis00 at gmail.com
Thu Jan 28 10:01:24 EST 2010


Raymond McLaughlin wrote:
> MDLUGers:
> I have been chasing this around for over an hour, the man page is no
> help,  and it's bugging me.
> 
> I have a directory off my home:
>    ~/bin .
> This directory contains an executable:
>    ~/bin/clearline .
> I want to create a simlink in this directory that looks like this:
>    bin/cln -> clearline
> 
> The simplest way to just do it is:
>     $ cd bin
>     $ ln -s clearline cln
> 
> But I should be able to do this with one command, from within my home
> directory.
> 
> But this is what happens: the command
>     $ ln -s bin/clearline  cln
> results in a simlink to the right file, but in the current (home) directory.
> 
> The commands:
>      $ln -s bin/clearline ~/bin/cln
> and
>      $ln -s bin/clearline ./bin/cln
> results in malformed simlinks *in the ~/bin directory:
>  bin/cln -> bin/clearline
> that point to a file in a nonexistent subdirectory: ~/bin/bin .
> 
> The command:
>     $ ln -s ~/bin/clearline  ~/bin/cln
> does create a link to the right file, in the right directory, but it
> takes the form:
>     cln -> /home/rmclaughlin/bin/clearline

ln -s works like this:

ln -s  $A $B

will result in the end of an ls -l listing like this:
   $B -> $A

So, from your home directory:

you want
   /bin/cln -> clearline

so

ln -s clearline /bin/cln

The way you were working was for "hard"
(non-symbolic) links.

> rather than the desired
>     cln -> clearline .
> 
> I could have worked around this with a cd command and then the link
> command, but it just bugs me that I can't come up with a working single
> command sytax.
> 
> It's probably obvious, but I don't see it. Any help?
> 
> Raymond McLaughlin



More information about the mdlug mailing list