Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
All entries in the filesystem are "hard links". A hard link goes from a name to an "inode number". The "inode" contains information about the file's permissions, ownership, type, and location on disk if any.

The link operator makes additional names that have the same inode number, so that they are really the same file, but with two (or more) different names. There's no "real" name; they are all equally valid. Only when you've removed the last name for an inode will the system consider removing the data. So the rm command, or the unlink operator, is removing a name, not an inode.

The symlink operator creates an inode with a name "pointer". When you reference the inode, its contents are substituted for the name, and the name lookup continues. Thnk of the "see ____" entry in an index. Now, that name might not be reachable or still exist, in which case you'll get a file-not-found error. Or it might in turn have another symlink... you're allowed to hop some small number of times (like 8 or 16, if I recall, depending on the kernel).

Because inode numbers are within a particular "device" (think: "drive partition"), you can't have a "hard link" from one "device" to another. But you can "symlink" anywhere you want. Also, to keep the nice orderly hierarchy of nested directories clean, only the superuser can "hard link" to a directory, but anyone can create a symlink to a directory.

-- Randal L. Schwartz, Perl hacker


In reply to Hard links vs symbolic links by merlyn
in thread Quiz for Newbie by bambam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found