Alexander Nasonov's shared items

Monday, November 20, 2006

How to remember arguments order in ln -s command

I couldn't remember for a long time what should go first after ln -s. It came to me when I learnt about !$ (last argument of last executed command). $ touch x $ ln -s x y $ file !$ file y y: symbolic link to x


  1. Anonymous3:58 pm

    Thanks, this saved my life. It was driving me nuts trying to remember how to do this. This is simple and concise. Five stars!

  2. For some reason I can't get this command to work. Please help.

    On an intel x86 BSD box with 4G ram.

    C:\>ln -s
    'ln' is not recognized as an internal or external command,
    operable program or batch file.


  3. This comment has been removed by the author.

  4. Hey Alex!

    After using linux for many years, I was still struggeling too to remember the order of the 'ln -s' params.

    But I think this will be my saviour: it's the same order as 'cp'. Do this and see if it helps:

    $ echo test > org
    $ cp org copy # order is intuitive
    $ ln -s org live.copy # order becomes intuitive (for me at least)

    The terms for ln is swapped, though. The 'org' is the target (source for cp), and the live.copy the link-name (target for cp).