6

This question already has an answer here:

I have an issue with ln -s on Ubuntu 14.04, while using it in the following scenario:

$ cd ~/programming/tmux/
$ ln -s tmux ~/bin/tmux
$ ls -l ~/bin/tmux
lrwxrwxrwx 1 USER USER 4 sie 31 11:02 /home/USER/bin/tmux -> tmux

Why is it like so? When I create it giving the absolute path everything works fine:

$ ln -s ~/programming/tmux/tmux ~/bin/tmux
$ ls -l ~/bin/tmux
lrwxrwxrwx 1 USER USER 4 sie 31 11:02 /home/USER/bin/tmux -> ~/programming/tmux/tmux

marked as duplicate by Gilles, Networker, Shadur, jasonwryan, slm Sep 1 '14 at 1:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The shell expands ~ so ln never sees ~. And if it did, it wouldn't be able to make sense of it and it would fail with a file not found error. You can see this if you quote your link, ala '~/bin/tmux' – bsd Aug 31 '14 at 9:49
11

When you write

ln -s VALUE link_name

it creates a symbolic link with value VALUE. This is what you got. If you want to create a relative link, it is best to cd to the directory where you want to put the link:

$ cd ~/bin
$ ln -s ../programming/tmux/tmux .

Shell completion will help you.

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