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!
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a location in my UNIX home directory. I can understand that it is not an actual location and it is a link. So I just want to know which location it is pointing too.
not sure i understand the question but if your asking about symbolic links then you can get the file it is pointing to by running this command:
ls -l <filename>
#create test sym link to file t.t
ln -s t.t symlink
# display results
ls -l
-rw-rw-r--. 1 chris chris 68 Mar 15 16:54 t.t
lrwxrwxrwx. 1 chris chris 3 Mar 19 10:52 symlink -> t.t
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.