ln(1) CLIX ln(1)
NAME
ln - Links files
SYNOPSIS
ln [-f] [-s] file ... target
FLAGS
-s Creates target as a symbolic link
-f Supresses asking of questions if the target doesn't have write
permission. Useful for shell scripts.
DESCRIPTION
The ln links file ... to target. The file and target can never be the
same. If target is a directory, one or more files are linked to that
directory. If target is a file, its contents are destroyed.
By default, the ln command makes hard links. A hard link to a file cannot
be distinguished from the original directory entry; any changes to a file
are effective independently from the name used to reference the file.
Hard links cannot span file systems and may not refer to directories.
The -s flag causes the 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() operation is performed on the link. A stat() on a
symbolic link will return the file that was linked to; an lstat() must be
executed to obtain information about the link. The readlink() call may be
used to read the contents of a symbolic link. Symbolic links may span
file systems and refer to directories. If a symbolic link is made to a
file and the file is removed, the link remains and is invalid.
If the ln command determines that the mode of target forbids writing, it
displays the mode (see chmod()), prompts for a response, and reads from
stdin for one line. If the line begins with y, the link occurs if it is
permissible. If not, the command exits. When the -f flag is used or if
stdin is not a terminal, no questions are asked and the link is executed.
EXAMPLES
1. The following creates hard links for filea and fileb in the directory
thisdir:
ln filea fileb thisdir
2. The following creates pp as a symbolic link to tp:
2/94 - Intergraph Corporation 1
ln(1) CLIX ln(1)
ln -s tp pp
If an ls -l is performed, pp will appear as pp@ -> tp.
CAUTIONS
The ln command will not create hard links across file systems.
Use shell metacharacters carefully.
DIAGNOSTICS
The ln command produces the following diagnostic messages.
ln: file and file are identical
A link between the two files already exists.
ln: different file system
An attempt was made to create a hard link across multiple file
systems. When this happens, the ln command fails.
EXIT VALUES
The ln command returns the following exit values:
0 Successful completion.
2 Other errors.
3 Insufficient memory.
RELATED INFORMATION
Commands: chmod(1), rm(1), cp(1), mv(1)
2 Intergraph Corporation - 2/94