NAME
ln — link
files
SYNOPSIS
ln |
[-f] source_file
target_file |
ln |
[-f] source_file...
target_dir |
DESCRIPTION
In the first synopsis form, the ln utility
will create a new directory entry (link) for the file specified by the
source_file operand, at the destination path specified by the target_file
operand. This first synopsis form is assumed when the final operand does not
name an existing directory; if more than two operands are specified and the
final is not an existing directory, an error will result.
In the second synopsis form, the
ln utility will create a new directory entry for
each file specified by a source_file operand, at a
destination path in the existing directory named by
target_dir.
If the last operand specifies an existing file of a type not specified by the XSH specification, the behaviour is implementation-dependent.
The corresponding destination path for each source_file will be the concatenation of the target directory pathname, a slash character, and the last pathname component of the source_file. The second synopsis form will be assumed when the final operand names an existing directory.
For each source_file:
- If the destination path exists:
- If the
-foption is not specified,lnwill write a diagnostic message to standard error, do nothing more with the current source_file, and go on to any remaining source_files.Actions will be performed equivalent to the XSH specification unlink() function, called using destination as the path argument. If this fails for any reason,
lnwill write a diagnostic message to standard error, do nothing more with the current source_file, and go on to any remaining source_files. - Actions will be performed equivalent to the XSH specification link(3) function using source_file as the path1 argument, and the destination path as the path2 argument.
OPTIONS
The ln utility supports the XBD
specification,
Utility
Syntax Guidelines .
The following option is supported:
- -f
- Force existing destination pathnames to be removed to allow the link.
OPERANDS
The following operands are supported:
- source_file
- A pathname of a file to be linked. This can be a regular or special file; whether a directory can be linked is implementation-dependent.
- target_file
- The pathname of the new directory entry to be created.
- target_dir
- A pathname of an existing directory in which the new directory entries are to be created.
STDIN
Not used.
INPUT FILES
None.
ENVIRONMENT VARIABLES
The following environment variables affect the execution of
ln :
LANG- Provide a default value for the internationalisation variables that are
unset or null. If
LANGis unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined. LC_ALL- If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE- Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES- Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH- Determine the location of message catalogues for the processing of LC_MESSAGES .
ASYNCHRONOUS EVENTS
Default.
STDOUT
Not used.
STDERR
Used only for diagnostic messages.
OUTPUT FILES
None.
EXTENDED DESCRIPTION
None.
EXIT STATUS
The following exit values are returned:
CONSEQUENCES OF ERRORS
Default.
APPLICATION USAGE
None.
EXAMPLES
None.
FUTURE DIRECTIONS
None.