I am now under a directory with very long path. For future visiting it quicker, I would like to create a link to it.I triedln -s . ~/mylink~/mylink actually links to ~. So can I expand ~ into the obsolute pathname, and then give it to ln?
Create an absolute symbolic link to the current directory
shell;symlink;cwd
A symlink actually stores the path you give literally, as a string. That means your link ~/mylink contains . (one character). When you access the link, that path is interpreted relative to where the link is, rather than where you were when you made the link.Instead, you can store the actual path you want in the link:ln -s $(pwd) ~/mylinkusing command substitution to put the output of pwd (the working directory name) into your command line. ln sees the full path and stores it into your symlink, which will then point to the right place. More or less.