I'm trying to create a symbolic link which would be system-wide usable. The $PATH output is the follow: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games So I don't understand why if I create a sl for example in /bin this symlink only works from inside the /bin directory and not from others directories.

For example:

# cd /bin 
# ln -s /media/bc7bc3eb-4ba9-4c12-8066-5f2e9ea747ec/SharedHOME/ ./shome
  • 2
    The symbolic Link does not understand that you want it to search $PATH, as a Symbolic Link is relative to it's parent only. – eyoung100 Nov 24 '14 at 16:07

The $PATH environment variable is only used when you run an executable.

In your case, you've symlinked a directory. As a directory isn't an executable, then your shell will not search $PATH for it.

If you symlink to an executable, you'll find that it works as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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