ln(1) MPE/iX Shell and Utilities ln(1)
______________________________________________________________________
NAME
ln -- create a link to an existing file
SYNOPSIS
ln [-fiRrs] old new
ln [-fiRrs] old old ... dir
DESCRIPTION
Note: The MPE/iX implementation of this utility does not function
exactly as this man page describes. For details, see the MPE/iX
NOTES section at the end of this man page.
ln creates a link to an existing file or set of files. A link is
a new directory entry that refers to the same file. This entry
can be in the same directory that currently contains the file or
in a different directory. The result is that you get a new path
name that refers to the file. You can access the file under the
old path name or the new one. Both path names are of equal
importance. If you rm either name, the other one still remains
and the file contents are still available under that name. The
contents of the file do not disappear until you remove the last
link.
A file may have any number of links to it. Thus you can estab-
lish any number of different path names for any file.
In the first form given in the synopsis, new becomes a new path
name for the existing file old.
In the second form, ln creates entries for all the old files
under the directory dir. For example,
ln yourdir/* mydir
creates links under mydir to all the files under yourdir. The
files have the same names under mydir that they had under
yourdir. ln always assumes this directory form when the last
operand on the command line is the name of a directory. In this
case, none of the old names may be a directory.
It is possible that there is already a file that has the same
name as the link you are trying to set up. We'll refer to this
file as the conflicting path name. To deal with a conflicting
path name, ln follows these steps.
* If you have specified -i, ln writes a prompt to standard error
to ask if you want to get rid of the conflicting path name. If
you answer affirmatively, ln attempts to remove it.
* Otherwise, if you have specified -f, ln attempts to remove the
conflict silently.
1
ln(1) MPE/iX Shell and Utilities ln(1)
______________________________________________________________________
* Otherwise, ln prints a diagnostic message.
* ln gets to this point if it is going to get rid of the con-
flicting path name. It therefore attempts to get rid of the
conflicting path name in the same way that rm does. ln deletes
the file associated with the path name if this path name is the
last link to the file. If ln can't get rid of the conflicting
path name, it does not attempt to establish the new link; it
writes an error message to the standard error and goes on to
the next file.
* If ln successfully gets rid of the conflicting path name, it
then establishes the link.
Options
ln accepts the following options:
-f gets rid of any conflicting path names without asking you
for confirmation.
-i checks with you before getting rid of conflicting path
names. You must not specify both -f and -i.
-R links files recursively. That is, you can link an entire
hierarchy of subdirectories at once.
-r is identical to -R.
-s Creates a symbolic link.
DIAGNOSTICS
Possible exit status values are:
0 All requested links were established successfully.
1 Failure due to any of the following:
-- an argument had a trailing / but was not the name of a directory
-- a file could not be found
-- an input file could not be opened for reading
-- an output file could not be created or opened for output
-- the new link file already exists
-- a link could not be established
-- a read error occurred on an input file
-- a write error occurred on an output file
-- the input and output files were the same file
-- inability to access a file when using -r
-- inability to read a directory when using -r
-- inability to create a directory when using -r
-- a target is not a directory when using -r
-- source and destination directory are the same when using -r
2 Failure due to any of the following:
-- invalid command line option
2
ln(1) MPE/iX Shell and Utilities ln(1)
______________________________________________________________________
-- too few arguments on the command line
-- a target that should be a directory but isn't
-- no space left on target device
-- out of memory to hold the data to be copied
-- the inability to create a directory to hold a target file
Messages
Message: cannot allocate I/O buffer: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: cannot allocate target string
Cause: There are not enough free system resources to hold the
name of the target file.
Action: Free up more system resources.
Message: cannot mkdir "pathname": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: cannot open file "filename": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: Cannot reset permissions on file "filename": system
error
Cause: See syserror(3).
Action: See syserror(3).
Message: Cannot reset times on file "filename": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: Cannot reset uid or gid on file "filename": system
error
Cause: See syserror(3).
Action: See syserror(3).
Message: Error copying file file1 to file2: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: fifo "filename": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: link to target "filename" failed: system error
Cause: See syserror(3).
Action: See syserror(3).
Message: no space on device for file "filename"
Cause: You attempted to copy (or move) a file to filename on a
3
ln(1) MPE/iX Shell and Utilities ln(1)
______________________________________________________________________
device that has no space for it.
Action: Free up space on the target device or copy (or move)
the file to another device.
Message: "pathname" is a directory (not copied): system error
Cause: See syserror(3).
Action: See syserror(3).
Message: read error on file "filename": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: recursive copy to directory "pathname"
Cause: You tried to recursively link a directory to itself.
Action: Choose a different pathname.
Message: source "name1" and target "name2" are identical
Cause: You specified source and target files that are actually
the same file (for example, because of links).
Action: No further action is required.
Message: special file "filename": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: target file "filename": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: target "pathname" is not a directory
Cause: When recursively copying (or moving) multiple files
using the -r or -R option, the target must be a direc-
tory. You specified a target pathname that is not a
directory.
Action: Check spelling of target pathname.
Message: target "pathname" must be a directory
Cause: You attempted to copy (or move) two or more files but
the target indicated by name was not a directory.
Action: When copying (or moving) two or more files, ensure that
the final name on the command line is a directory.
Message: target "pathname" must exist
Cause: The destination directory must exist for this utility
to work.
Action: Check the command line arguments. You may need to cre-
ate the target directory.
Message: Unknown option "-option"
Cause: You specified an option that is not valid for this com-
mand.
Action: Check the Options section of the command's man page for
a list of valid options.
4
ln(1) MPE/iX Shell and Utilities ln(1)
______________________________________________________________________
Message: unreadable directory "pathname": system error
Cause: See syserror(3).
Action: See syserror(3).
Message: write error on file "filename": system error
Cause: See syserror(3).
Action: See syserror(3).
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems.
The -s option only works on file systems which support symbolic
links.
Only the -f option is part of the POSIX standard.
MPE/iX NOTES
This release of MPE/iX does not support the creation of addi-
tional hard links to a file. It is only possible to create sym-
bolic links at this time.
In addition, because this release of MPE/iX does not provide the
lstat() API, this command cannot return information on the link
itself. It attempts to determine when a symbolic link has been
referenced, but can only return the information on the target of
the link, rather than the link itself.
On MPE/iX, ln is available as both a built-in shell utility and
an external utility.
For more information on how the current MPE/iX implementation may
affect the operation of this utility, see Appendix A, MPE/iX
Implementation Considerations.
SEE ALSO
cp(1), locale(1), mv(1), rm(1)
5