Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy home page: puppylinux.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 09 Feb 2010, 12:37
All times are UTC - 4
 Forum index » House Training » Beginners Help ( Start Here)
Question about links (hard and sym) (Answered)
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
diaeresis

Joined: 16 Sep 2009
Posts: 165

PostPosted: Sat 07 Nov 2009, 18:13    Post_subject:  Question about links (hard and sym) (Answered)  

So, in the terminal I can ln or ln -s
whats the difference and how do these relate to the 'relative' and 'absolute' options I get when dragging a file/directory from one rox window to another?
Back to top
View user's profile Send_private_message Send_email 
diaeresis

Joined: 16 Sep 2009
Posts: 165

PostPosted: Sat 07 Nov 2009, 19:23    Post_subject:  

OK answered it myself. Took a bit of effort as most of the stuff out there is about html design but if anyone else is interested here is a good start.

http://www.linuxformat.co.uk/forums/viewtopic.php?p=79553
Back to top
View user's profile Send_private_message Send_email 
Pizzasgood


Joined: 04 May 2005
Posts: 5949
Location: Fourth Floor, USA (EST/GMT-5)

PostPosted: Sat 07 Nov 2009, 22:37    Post_subject:  

A hard link points at a location on the harddrive. Every file is a hardlink. Basically, you can think of a hardlink as the name that points at the data.

Data on the harddrive "exists" as long as at least one name points at it. When there is only one name pointing at it and you delete that name, the file is considered deleted. (Actually the data is still there, but the area of the disk where it lives is now considered "free", so that when you try to write new data to the drive, it might overwrite the old "deleted" data.)

So, let's say I have a file named "bob". If I make a hardlink to bob that is named cindy, I will then have two names for the same data. They are indistinguishible. There is no way to determine which is the real one and which is the link - because they are both equally real. I can delete bob, and the data will still be there because cindy still points at it.


Symlinks (symbolic links) are different. A symlink is more like a "shortcut" from Windows (but generally better). Hard links point at data. Symlinks point at a filename. So if you have a file named "thomas" and you make a symlink to thomas named "rebecca", those are not identical. The "thomas" item points at the data. The "rebecca" item only points at thomas. If you delete thomas, rebecca will still be pointing at thomas, but since thomas isn't there, he can't point you to the data. Therefor the data is deleted, and rebecca is a broken link.


Since hard links point at actual data, they have to be on the same partition as the data they point at. Since symlinks only point at a filename, they can point at any filename on the system.

_________________
Mashed potatoes can be your friends. ---Weird Al

Back to top
View user's profile Send_private_message Visit_website 
diaeresis

Joined: 16 Sep 2009
Posts: 165

PostPosted: Sun 08 Nov 2009, 07:17    Post_subject:  

Ok, I think i have it but if someone could just confirm this for me.
in the terminal ln will create a hard link.
ln -s will create a symbolic link which can be either absolute or relative according to how the link name is written. A full path gives an absolute link and something else that I am not quite sure of gives a relative link. The absolute and relative links are those used by rox.
And if I want things to "just work" I should stick to absolute links when using rox.
Is that a reasonable stab at getting my head round this?

Thanks.
Back to top
View user's profile Send_private_message Send_email 
lapis

Joined: 02 Jun 2008
Posts: 124

PostPosted: Sun 08 Nov 2009, 11:00    Post_subject:  

I had thought I understood this but after reading this thread it appears may be not. Could someone please confirm?

My understanding of absolute and relative was as follows:
Absolute: path is stored relative to /
Relative: path is stored relative to target.

Relative link and target can be moved and the link will stay intact.
If absolute link and target are moved then the link will be broken.
Back to top
View user's profile Send_private_message 
Sit Heel Speak


Joined: 30 Mar 2006
Posts: 2059
Location: Pugetopolis

PostPosted: Sun 08 Nov 2009, 12:43    Post_subject:  

(deleted by poster, erroneous. See Pizzasgood's message, below)
Edited_time_total
Back to top
View user's profile Send_private_message 
Pizzasgood


Joined: 04 May 2005
Posts: 5949
Location: Fourth Floor, USA (EST/GMT-5)

PostPosted: Sun 08 Nov 2009, 18:08    Post_subject:  

No no no no no.

Absolute != hard.

A hard link is a hard link. There is no concept of absolute vs. relative for hard links. They don't involve filenames at all, they point at the data on the disk.

Only a symlink can be relative or absolute. Lapis had it right:
Quote:
My understanding of absolute and relative was as follows:
Absolute: path is stored relative to /
Relative: path is stored relative to target.


Also, ROX-Filer will NOT let you create a hard link. You have to do that by hand.


So, in summary:

Hard Link
    Created with plain ln
    Points at the actual data.
    Can be moved and will point at the original data.
    Must be on the same partition as the target data.
    Is neither absolute nor relative - simply is.
    Has no arrow emblem over the icon.


Absolute Symbolic Link
    Created with ln -s
    Points at a filename, not at the actual data in question.
    Uses an absolute path to the destination, starting from /
    Can be moved and will point at the original target if that did not move.
    Can point across partitions.
    Has an arrow emblem over the icon.


Relative Symbolic Link
    Created with ln -s
    Points at a filename, not at the actual data in question.
    Uses a relative path to the destination, starting from wherever it is located.
    If moved, it will generally not point at the original item unless the original item was also moved so that the relative path between them stayed the same.
    Can point across partitions.
    Has an arrow emblem over the icon.

_________________
Mashed potatoes can be your friends. ---Weird Al

Back to top
View user's profile Send_private_message Visit_website 
Sit Heel Speak


Joined: 30 Mar 2006
Posts: 2059
Location: Pugetopolis

PostPosted: Sun 08 Nov 2009, 20:36    Post_subject:  

I stand corrected.

From ln --help:
Code:
  -s, --symbolic              make symbolic links instead of hard links

Thus I inferred, erroneously, that hard==absolute.
Back to top
View user's profile Send_private_message 
DaveS


Joined: 09 Oct 2008
Posts: 1413
Location: UK

PostPosted: Mon 09 Nov 2009, 02:56    Post_subject:  

Pizzasgood wrote:
No no no no no.

Absolute != hard.

A hard link is a hard link. There is no concept of absolute vs. relative for hard links. They don't involve filenames at all, they point at the data on the disk.

Only a symlink can be relative or absolute. Lapis had it right:
Quote:
My understanding of absolute and relative was as follows:
Absolute: path is stored relative to /
Relative: path is stored relative to target.


Also, ROX-Filer will NOT let you create a hard link. You have to do that by hand.


So, in summary:

Hard Link
    Created with plain ln
    Points at the actual data.
    Can be moved and will point at the original data.
    Must be on the same partition as the target data.
    Is neither absolute nor relative - simply is.
    Has no arrow emblem over the icon.


Absolute Symbolic Link
    Created with ln -s
    Points at a filename, not at the actual data in question.
    Uses an absolute path to the destination, starting from /
    Can be moved and will point at the original target if that did not move.
    Can point across partitions.
    Has an arrow emblem over the icon.


Relative Symbolic Link
    Created with ln -s
    Points at a filename, not at the actual data in question.
    Uses a relative path to the destination, starting from wherever it is located.
    If moved, it will generally not point at the original item unless the original item was also moved so that the relative path between them stayed the same.
    Can point across partitions.
    Has an arrow emblem over the icon.


Thanks for this Pizzasgood.............. finally, a clear concise explanation of absolute/relative linking.

_________________
Puppy 4.3 Frugal HD and USB
Puppy 4.2 Frugal HD and USB
Root forever!
Back to top
View user's profile Send_private_message 
diaeresis

Joined: 16 Sep 2009
Posts: 165

PostPosted: Mon 09 Nov 2009, 08:04    Post_subject:  

And thanks from here, now I have it!
Back to top
View user's profile Send_private_message Send_email 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Beginners Help ( Start Here)
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
hot copy
[ Time: 0.2882s ][ Queries: 9 (0.0078s) ][ Debug on ]