Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ln(1) — SunOS 5.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1)

cp(1)

mv(1)

rm(1)

link(1M)

readlink(2)

stat(2)

symlink(2)

ln(1)

NAME

ln − make hard or symbolic links to files

SYNOPSIS

ln [ −f ] [ −n ] [ −s ] filename1 [ filename2...filenamen ] target

AVAILABILITY

SUNWcsu

DESCRIPTION

The ln command links filenamen to target by creating a directory entry that refers to target. By using ln with one or more file names, the user may create one or more links to target.

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. 

Without the −s option, ln is used to create hard links.  filenamen is linked to target. If target is a directory, another file named filenamen is created in target and linked to the original filenamen. If target is a file, its contents are overwritten. 

If ln determines that the mode of target forbids writing, it will print the mode (see chmod(2)), ask for a response, and read the standard input for one line.  If the line begins with y, the link occurs, if permissible; otherwise, the command exits. 

OPTIONS

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

−n If the linkname 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.  A symbolic link contains the name of the file to which it is linked.  Symbolic links may span file systems and may refer to directories. 

If the −s option is used with two arguments, target may be an existing directory or a non-existent file.  If target already exists and is not a directory, an error is returned.  filenamen may be any path name and need not exist.  If it exists, it may be a file or directory and may reside on a different file system from target. If target is an existing directory, a file is created in directory target whose name is filenamen or the last component of filenamen. This file is a symbolic link that references filenamen. If target does not exist, a file with name target is created and it is a symbolic link that references filenamen.

If the −s option is used with more than two arguments, target must be an existing directory or an error will be returned.  For each filenamen, a file is created in target whose name is filenamen or its last component; each new filenamen is a symbolic link to the original filenamen. The files and target may reside on different file systems. 

SEE ALSO

chmod(1), cp(1), mv(1), rm(1), link(1M), readlink(2), stat(2), symlink(2)

Sun Microsystems  —  Last change: 26 Sep 1992

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