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.
As you spell your name the same way as my best friend:
I would move that folder somewhere more global, like /usr/local/firefox
Assuming you do that (though these instructions are easily modified if you decide not to):
Code:
ln -s /usr/local/firefox/firefox /usr/bin/firefox
will create a link in /usr/bin (which is in the path, meaning that in future you can just type firefox to run it).
The command above means: ln
(that L N) Create a link -s
(make it a symbolic link - don't worry what that means for now) /usr/local/firefox/firefox
(link from the file 'firefox' in the directory /usr/local/firefox) /usr/bin/firefox
(create the link as 'firefox' in the directory /usr/bin)
There are two types of links, soft (or symbolic links) and hard links. To understand the differences, you have to understand how *nix filesystems works. Basically, to the system, files are not known by their name but by their inode on the filesystem. An inode may be associated with multiple names. A hard link (no -s flag to ln) is when you associate a new name to an inode (actually you do this indirectly by referring to another file name that points to that inode). Every time you create a hard link to an inode, its reference count increases (opening the file in a program does the same, and closing it decrements the ref count). When the reference count drops to 0, the disk space is reclaimed. That's why the traditional Unix file removal system call is called unlink -- you're not necessarily removing the file, just unlinking one of the name from it.
Now, onto to symbolic links. These are essentially shortcuts. basically, a symbolic links is a file. But it's a special kind of file that basically just says "don't look at me, look for this other file." The key point is that the other file is referenced by NAME, not inode. Therefore, it's perfectly possible to have a dangling symlink (i.e. one that points to a file name that no longer exists). Also note as a consequence of this, when you create a symlink to a file, the reference count does not increase. Therefore if you do:
touch foo
ln -s foo bar
rm foo
then bar will point to nothing (dangling symlink). But if you did
touch foo
ln foo bar
rm foo
bar would still "work" as a file.
There, that's probably more than you ever wanted to know on the topic .
ah.. ok.. it seems a bit more clear now, not completely but more. thanks for the knowledge.
it seems somewhat similar to concepts of, say, OOP.. like garbage collection.. when theres no more variable names pointing at objects, it is then unneeded and it's resources are freed up.. i forget what other analogy like this i was meaning to say, but oh welll..
The first file IS the file. The second is a hard link, the third is a symbolic link. This is the output of ls -l by the way. For the symlink, the first letter in the permissions sequence at the front is 'l' for 'link'. With the hard link and the file, the number '2' (second column) indicates that 2 links to the file exist - i.e. if the number is greater than 1 then the file is either a hard link or has a hard link to it. That second column is also used for directories to show how many files are within it, but in that case the very first letter in the permission sequence is 'd'.
The example begs more questions: how does one distinguish a hard link from the real file (zoe_tips2 from zoe_tips) based on what ls -l delivers? Does one infer the zoe_tips2 link from accounting the connected links, one hard link plus one soft link = 2 links? And finally how does one delete the hard link if it is indistinguishable from the real file?
Thank you for any more insight.
mate don't drag up old threads, this one is VERY long dead. and as for your question there is no difference. it's just and area of disk space referenced from two FAT entries instead of one. a hard link does not link from one name to another, that is a soft / symbolic link. the hard link only uses the original name to obtain the location of the file in question. a second link is *exactly* the same as the first one other than name.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.