🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.linux
Article #47313

Re: Linking Files

#47313
From: James Cribb
Date: Tue, 12 Jan 1999 00:00
40 lines
1817 bytes
In article <77ek9h$94p5@iccu9.ipswich.gil.com.au>, Stuart Folo wrote:
| Hello I would like to know the easyest way to link two files between two
| different directories?

    ln existingFile newFile
    ln existingFile1 existingFile2 ... existingFileN otherDirectory

Run "man ln" to see the manual entry for "ln".

The meaning of the "-s" option is not well explained in the manuals.
"ln -s" is the only way to link files on different filesystems, but
newFile is only a pointer to existingFile, so if you delete existingFile
you won't be able to see it via the newFile pointer:

    $ echo hi >file1
    $ ln file1 file2   
    $ ln -s file1 file3
    $ ls -l file*
    -rw-rw-r--   2 jamesc   jamesc          3 Jan 12 19:46 file1
    -rw-rw-r--   2 jamesc   jamesc          3 Jan 12 19:46 file2
    lrwxrwxrwx   1 jamesc   jamesc          5 Jan 12 19:47 file3 -> file1
    $ cat file1
    hi
    $ cat file2
    hi
    $ cat file3
    hi
    $ rm file1
    $ ls -l file*
    -rw-rw-r--   1 jamesc   jamesc          3 Jan 12 19:46 file2
    lrwxrwxrwx   1 jamesc   jamesc          5 Jan 12 19:47 file3 -> file1
    $ cat file1
    cat: file1: No such file or directory
    $ cat file2
    hi
    $ cat file3
    cat: file3: No such file or directory

That last one is a bit unintuitive, because the pointer is still there,
but what it points to is not still there so it gives an error.
Technical Details
Message-ID: <77f2ib$vn2$1@the-fly.zip.com.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <77ek9h$94p5@iccu9.ipswich.gil.com.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 102983,98e6b0d1bac5d6e4
X-Google-Attributes: gid102983,public
From: jamesc@zip.com.au (James Cribb)
Subject: Re: Linking Files
Date: 1999/01/12
Message-ID: <77f2ib$vn2$1@the-fly.zip.com.au>
X-Deja-AN: 431581915
References: <77ek9h$94p5@iccu9.ipswich.gil.com.au>
Organization: The Zipsters
Newsgroups: aus.computers.linux