Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1)

cp(1)

mv(1)

universe(1)

getuniverse(2)

link(2)

readlink(2)

stat(2)

symlink(2)

ln(1)

NAME

ln − link files

SYNOPSIS

ln [ −s ] [ −f ] [ −n ] file [ target ]
ln [ −s ] [ −f ] [ −n ] file ... directory

DESCRIPTION

A link is a directory entry referring to a file; the same file (together with its size, all its protection information, etc.)  may have several links to it.  There are two kinds of links: hard links and symbolic links. 

The ln command may be used to create both hard links and symbolic links.  By default it creates hard links.  A hard link to a file is indistinguishable from the original directory entry.  Any changes to a file are effective independent of the name used to reference the file.  Hard links may not span file systems and may not refer to directories. 

The −s option causes ln to create symbolic links.  A symbolic link contains the name of the file to which it is linked.  The referenced file is used when an open(2) operation is performed on the link.  A stat(2) on a symbolic link will return the linked-to file; an lstat(2) must be done to obtain information about the link.  The readlink(2) call may be used to read the contents of a symbolic link.  Symbolic links may span file systems and may refer to directories. 

A special case of a symbolic link, called a conditional symbolic link, is created if the −s option is used and file contains the character sequence ‘{}’.  The braces are replaced by the name of the current universe whenever the symbolic link is used.  Hence a conditional symbolic link with a value of ‘.{}lib’ evaluates to ‘.attlib’ in the att universe.  The universe may be set with the universe(1) command. 

The following options are recognized:

−f ln will link files without questioning the user, even if the mode of the target forbids writing.  Note that this is the default if the standard input is not a terminal. 

−n If the target is an existing file, do not overwrite the contents of the file.  The −f option overrides this option. 

−s ln will create a symbolic link. 

Given one or two arguments, ln creates a link to an existing file file.  If target is a directory, another file with the same simple filename (the last component of the full pathname) of file is created in the directory target and linked to the original file. If target is a file, its contents are overwritten unless the −s option is used, in which case an error is reported.  If no target is supplied, a link having the same simple filename as file is created in the current directory. 

Given more than two arguments, ln makes links to all the named files in the named directory. The links made will have the same simple filenames as the files being linked to.

If the two files are already links to the same file, an error message is printed (unless the −f option is used. 

If a file exists with the same name as the resultant link and write permission is denied on target file, ln will print the mode of the file (see chmod(2)), ask for a response, and read the standard input for one line; if the line begins with y, or the locale’s equivalent, the ln occurs, if permissable; if not, the command exits.  No questions are asked and the linking is performed if the −f option is used or the standard input is not a terminal. 

SEE ALSO

chmod(1), cp(1), mv(1), universe(1). 
getuniverse(2), link(2), readlink(2), stat(2), symlink(2) in the CX/UX Programmer’s Reference Manual.

CX/UX User’s Reference Manual

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026