LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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

Reply
 
Search this Thread
Old 04-25-2005, 05:16 PM   #1
~zoey~
Member
 
Registered: Aug 2004
Location: South Dakota
Distribution: ubuntu & PCLOS
Posts: 119

Rep: Reputation: 15
Question Create Link? How???


I have installed Firefox -1.0.3 in ubuntu warty and it installed OK, taking me to the webpage, but I can't get back to it again.

It is installed in ~/firefox-installer.

I imagine that I need to create a link, but I don't know how to do that.

Could someone please lead me by the hand?

Thanks, zoey
 
Old 04-25-2005, 05:30 PM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 53
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)

Hope this helps.
 
Old 04-25-2005, 07:31 PM   #3
~zoey~
Member
 
Registered: Aug 2004
Location: South Dakota
Distribution: ubuntu & PCLOS
Posts: 119

Original Poster
Rep: Reputation: 15
Thank you, thank you thank you! I now have it up and running.

zoey
 
Old 04-25-2005, 08:11 PM   #4
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 58
koma...
NOW can you explan what the -s option means? you said dont worry about it now... then :P

i understand what you said, and iv made afew before too... but:

is it basically the equivalent to M$' 'shortcut's?
what other type of links can you make?
 
Old 04-25-2005, 10:18 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,078

Rep: Reputation: 297Reputation: 297Reputation: 297
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 .
 
Old 04-25-2005, 10:33 PM   #6
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 58
lol..
yes.. precisely.

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..

thanks again
 
Old 06-20-2005, 06:46 AM   #7
basher400
Member
 
Registered: Mar 2005
Posts: 51

Rep: Reputation: 15
good info there btmiller.

I have created a hard link (I tested it, it really works) from file1 to file2.
Code:
ln file1 file2
(no -s)

but

what visual indication do I have when looking at the file system that the certain file points to another ?

when I do:
Code:
ls -l myfolder
the file (file2) looks the same as others in the same folder.
 
Old 06-20-2005, 12:22 PM   #8
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 53
Code:
-rw-r--r--   2 sab300 users      211 2005-03-22 21:42 zoe_tips
-rw-r--r--   2 sab300 users      211 2005-03-22 21:42 zoe_tips2
lrwxrwxrwx   1 sab300 users        8 2005-06-20 18:18 zoe_tips3 -> zoe_tips
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'.
 
Old 07-24-2006, 04:11 PM   #9
lmiklosy
LQ Newbie
 
Registered: May 2006
Posts: 2

Rep: Reputation: 0
Question Identifying then Removing hard link

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.
 
Old 07-24-2006, 04:23 PM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,384

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create a link of a program ? anindyanuri Linux - Software 7 06-19-2005 01:11 PM
how to create link to an executable? Finlay Slackware 12 10-09-2004 08:19 AM
How do I create a symbolic link? Arenba Linux - Newbie 4 09-29-2003 10:40 AM
How to create a link? sharathkv Linux - Newbie 4 07-29-2003 08:33 AM
how do I create a symbolic link? rdaves@earthlink.net Linux - Newbie 2 05-23-2001 01:28 PM


All times are GMT -5. The time now is 04:02 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration