DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

ln(1)


ln -- link files

Synopsis

/u95/bin/ln [-s] [-f] [-n] source_file target_file

ln [-s] [-f] [-n] source_file ... source_file target_file

ln -s [-f] [-n] source_dir target_dir

Description

In the first synopsis, the ln command creates a directory entry (link) pointing to the file source_file at the destination path specified by target_file. If target_file is a file that already exists, its contents are overwritten.

In the second synopsis, target_dir is an existing directory, and a link is created in the directory specified by target_dir for each source_file, using the last component of the path specified by source_file.

In the third synopsis, a link is created pointing to the directory source_dir at the destination path specified by target_dir. If target_dir is a directory that already exists, a link to source_dir is created under target_dir, using the last component of source_dir as the link name.

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.

There are three options to ln. If multiple options are specified, the one with the highest priority is used and the remainder are ignored. The options, in descending order of priority, are:


-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 linkname exists, then do not overwrite the contents of the file. A symbolic link's permissions are always set to read, write, and execute permission for owner, group, and world (777).

-f
ln will link files without generating any errors, even if the mode of the target_file forbids writing. If target_dir refers to a directory that has no write permissions, errors will still occur.

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

When used with only two arguments, the -s option can be used with an existing directory for target_dir directory or a non-existent file for target_file. If target_dir already exists and is not a directory, an error is returned. source_file 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_file or target_dir. If target is an existing directory, a file is created in directory target whose name is filen or the last component of filen. This file is a symbolic link that references filen. If target does not exist, a file with the name target is created and it is a symbolic link that references filen.

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

Files


/usr/lib/locale/locale/LC_MESSAGES/uxcore.abi
language-specific message file (see LANG on environ(5)).

References

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

Notices

Doing operations that involve .. (such as cd ..) in a directory that is symbolically linked will reference the original directory not the target.

The -s option does not use the current working directory. In the command ln -s path target, path is taken literally without being evaluated against the current working directory.

If the POSIX2 environment variable is set and exported, the behavior of ln with no options is the same as the current ln -n.

The -n option is for backward compatibility only. It should not be used, since it may be removed in future releases.

Use the POSIX2 environment variable to get POSIX.2 behavior that is inconsistent with existing System V behavior. POSIX2 requires no prompting in case of existing target.

This command has been updated to handle files greater than 2GB.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 02 June 2005