Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

the command usually works like a charm but this one ln -si GIT/Settings/session ./.mozilla/firefox/foo.default/ just creates some kind of broken link shown as a file.

Why is that?

Even sudo ln -fs doesn't work.

Any suggestions how to do that?

Thanks in advance.

share|improve this question

migrated from Sep 22 '12 at 20:48

This question came from our site for professional and enthusiast programmers.

Weird as it may sound,

ln -si ../../../GIT/Settings/session ./.mozilla/firefox/foo.default/

will do what you want. The rule of thumb here is that you should specify your link targets relative to the location where you're placing the link.

On Unix and Unix-like file systems, a symbolic link is actually a special file whose contents are a path. Typing ln path filename creates a symbolic link at filename whose contents are path. So if, for instance, you type

ln foo bar/baz

then your system will create a link named bar/baz containing the path "foo". That link, however, will be broken – when you try to dereference the link, your kernel dereferences it relative to the link directory – in this case, bar. Your kernel will look for bar/foo, which does not exist.

If, on the other hand, you type

ln ../foo bar/baz

then your system will create a link named bar/baz containing the path "../foo". Dereferencing this link, your kernel will look for bar/../foo, which does exist (and is in fact what you want).

share|improve this answer

You could use the full path of the source and target file

ln -s (full path to /foo) (full path to bar/baz)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.