Can somebody explain this `ln -s` command to me?

The command in question is:

sudo ln -s /usr/lib/x86_64-linux-gnu/foo.so /usr/lib/

I read this article about ln, which indicates that the latter argument can be either a name or a directory. In this case, with it being a directory, my assumption is that the above command causes access to /usr/lib/foo.so to be directed to /usr/lib/x86_64-linux-gnu/foo.so. If that's true, what is the value in omitting the name in the latter argument vs explicitly including the name (e.g., /usr/lib/foo.so)? Is this just a common shortcut, or is there a value in doing this? Also, does creating the symbolic link in this way have any other effect that it wouldn't if the name was included in the latter argument?

1 Answer

The purpose of omitting the name is that you will save time typing, considering that you may have multiple targets specified. See the manual.

ln [OPTION]... TARGET... DIRECTORY (3rd form)

In the 3rd and 4th forms, create links to each TARGET in DIRECTORY

7

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like