Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
[me@linuxbox playground]$ ln fun fun-hard
[me@linuxbox playground]$ ln fun dir1/fun-hard
[me@linuxbox playground]$ ln fun dir2/fun-hard
So now we have four instances of the file “fun”. Let's take a look our playground directory:
[me@linuxbox playground]$ ls -l
drwxrwxr-x 2 me me 4096 2008-01-14 16:17 dir1
drwxrwxr-x 2 me me 4096 2008-01-14 16:17 dir2
-rw-r--r-- 4 me me 1650 2008-01-10 16:33 fun
-rw-r--r-- 4 me me 1650 2008-01-10 16:33 fun-hard
why is dir1 and dir2 only showing 2 links? shouldnt they all be on 4??? as the fun file is linked to three other items, shouldnt they all share 4 links?
That's just how ln -s works. The target needs to be written from the destination's perspective, if that makes sense.
If you did "ln -s fun dir1/fun-sym", then fun-sym would be pointing to "fun" in its own directory. You always need to be careful when creating symlinks using a relative path to a destination other than your cwd. You need to ask yourself "How would I get to the target from the destination (regardless of where your cwd is), and that's how you need to write the target.
I usually find it easiest to just cd to the destination directory and then symlink from there, using tab completion if necessary.
Last edited by suicidaleggroll; 10-16-2014 at 01:24 PM.