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.
If it helps ... a "symbolic link" is basically a very tiny file containing: a filename. The filesystem knows that it's a link. So, when you refer to the link, Linux reads the filename of the target file from the link, and goes looking for that filename instead. Please notice that it searches for the target file by name, and that it does so when the link is actually referred-to. If the target file can't be found at this time, the attempt fails.
There's another kind of link, called a static link, which these days is so-infrequently used that I don't think we need bother talking about it here.
Every file is represented by an inode, every file that exists has at least ONE hard link. Every entry in a directory of a Linux native filesystem is represented by the pair (inode,name). Second EVERY directory has two entries "." and "..". The "." entry is a hard link to the directory itself (a hard link). The parent directory of that directory ALSO has a link (the directory name). Thus every directory has two hard links.
One very old programming technique uses multiple hard links to a single executable. When executed, the process receives a parameter list... that includes the name it was invoked by. Some programs use this to identify subfunctions of the application. The technique of using hard links for this has been replaced by using symbolic links instead (it makes it more "self-documenting"), but the result is still the same.
One such program that still does this is openssl. If a hard (or symbolic) link is made to /usr/bin/openssl and called "ciphers", then when the openssl application is invoked with the name "ciphers", will actually do the equivalent of the command "openssl ciphers".
The main advantage a hard link has is that it goes directly to the inode - a symbolic link has to reparse the file name from the symbolic link to continue following the directory path. The main DISADVANTAGE of the hard link is that it cannot cross filesystem mounts (each filesystem has its own inode list...). The other disadvantage is a bit of documentation of which file is actually referenced.
A minor disadvantage of symbolic links is that the target of a symbolic link can be deleted, leaving the symbolic link pointing nowhere... and programs that depend on it existing will not report a problem until you try to use the program. A file with multiple hard links is not deleted until the link count goes to 0. So this can't happen with hard links.