Reputation: 3047
I am trying to create a symbolic link on the server with the command ln -s
,
Option 1:
ln -s /home/thejobco/public_html/JCCore/ajax_search /home/thejobco/public_html/demo/typo3conf/ext/
result 1:
ajax_search -> /home/thejobco/public_html/JCCore/ajax_search
Option 2:
ln -s /home/thejobco/public_html/JCCore/ajax_search/ /home/thejobco/public_html/demo/typo3conf/ext/
result 2:
ajax_search -> /home/thejobco/public_html/JCCore/ajax_search/
Question:
I want to know if the above two options are the same, or there is different between them? Option 1 does not have /
, option 2 has /
, but both of them work well, so just wonder which is the standard way?
Upvotes: 0
Views: 798
Reputation: 263617
A symbolic link is implemented as a file containing the name of the target.
There is a minor difference, as you've seen: one of the symlinks has a trailing /
, and the other doesn't. You can see the difference in the output of ls -l
; on a lower level, this shows up as a difference in the path returned by the readlink()
system call.
But there should be no functional difference between them -- as long as the target is a directory. Either can be used to access the linked directory.
For a target that's not a directory, this:
ln -s /etc/motd good_link
ln -s /etc/motd/ bad_link
will result in good_link
being a valid way to access /etc/motd
, and bad_link
resulting in a not a directory
error.
Upvotes: 4