Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Hardlinks (was: Re: Does the bash bug have a zsh counterpart?)



Am 25.09.2014 um 18:53 schrieb William G. Scott:

(About 10 years ago I found a hard link to a then nonexistent ksh behaved properly whereas a symbolic link for whatever reason didn’t).

A hardlink is nothing more than another name for the same file. When ksh was deleted, the system has just deleted that one NAME of the file, but it stayed there under the other name (sh). That's the reason why you can't create hardlinks across filesystem borders. BTW: You can identify hardlinked files by looking at
  1. The link count:
    % touch foo
    % ln foo bar
    % ll foo bar
    -rw-r--r-- 2 someuser users 0 Sep 26 07:36 bar
    -rw-r--r-- 2 someuser users 0 Sep 26 07:36 foo
    % ln bar baz
    % ll foo bar baz
    -rw-r--r-- 3 someuser users 0 Sep 26 07:36 bar
    -rw-r--r-- 3 someuser users 0 Sep 26 07:36 baz
    -rw-r--r-- 3 someuser users 0 Sep 26 07:36 foo
  2. The inode number
    % ll -i foo bar baz
    22 -rw-r--r-- 3 someuser users 0 Sep 26 07:36 bar
    22 -rw-r--r-- 3 someuser users 0 Sep 26 07:36 baz
    22 -rw-r--r-- 3 someuser users 0 Sep 26 07:36 foo
The link count tells you whether a file has multiple names, while the inode number tells you which names a file has.

A symlink, OTOH, is just a NEW (special) file, pointing to another file which may exist or not.

HTH...

    Dirk
--

Dirk Heinrichs, Senior Systems Engineer, Engineering Solutions
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Tel: +49 2226 1596666 (Ansage) 1149
Email: dhs@xxxxxxxxxxxxx
Skype: dirk.heinrichs.recommind
www.recommind.com


Messages sorted by: Reverse Date, Date, Thread, Author