Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/utilities/l/ln.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/utilities/l/ln.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/utilities/l/ln.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/utilities/l/ln.html on line 8

ln

Create links to (aliases for) files (POSIX)

Syntax:

ln [-f|-i] [-Psv] source_file target_file

ln [-f|-i] [-Psv] source_file... target_dir

Runs on:

QNX Neutrino, Microsoft Windows

Options:

-f
Force existing destination pathnames to be removed before linking; don't prompt for confirmation.
-i
(QNX Neutrino extension) Run interactively; write a prompt to the standard error output requesting confirmation for each link that would overwrite an existing file.
-P
Create the link in the process manager's in-memory prefix tree.
-s
Create a symbolic link.
-v
Verbose. Write actions performed to standard output.
source_file
The pathname of a file to be linked. If -s is specified, this file need not exist.
target_file
The pathname of the new directory entry to be created.
target_dir
The pathname of an existing directory in which the new directory entries are to be created.

Description:

The ln utility has two syntax forms, as follows:

ln [-f|-i] [-s] source_file target_file
The ln utility creates a new directory entry (link) at the destination path specified by the target_file operand which points to the source_file as a hard or symbolic link, depending on the -s option. This syntax form is assumed when the destination path doesn't name an existing directory.
ln [-f|-i] [-s] source_file... target_dir
For each source_file, ln creates a new directory entry at a destination path in the existing directory named by the target_dir operand.

The destination path for each source_file is the same as its basename (final path component). For example:

    ln dir/dir/myfile /existingdir
creates /existingdir/myfile as a link to dir/dir/myfile.

This second syntax form is assumed when either the destination names an existing directory, or when more than one source file is specified.

If the destination path exists and you have write permission for the existing destination file, or if -f was specified, ln unlinks the destination, then creates the new link.

If you don't have write permission for an existing directory path, and -f isn't specified, and if the standard input is a tty, ln prompts you for confirmation prior to unlinking the existing file. If standard input isn't a tty, ln writes a diagnostic message to standard error, and goes on to the next source_file without unlinking the destination file.

To create the new link, or replace a file with a link, you need write permissions for the directory in which the new link is going to reside. Note that root always has this permission regardless of the file permission settings.

Hard links are limited to within the same filesystem as the original file and aren't permitted on directories. With symbolic links, however, you can link any pathname to a file. A symbolic link is a special file that has the destination pathname as its data. For more information, see the section on symbolic links in System Architecture.

If the -P option is specified, the link is created within the pathname prefix tree maintained in memory by the QNX Neutrino process manager, procnto. This lets you create new pathname links without the need for a traditional filesystem. If the -s option is specified, a symbolic redirection takes place. If -s isn't specified, a direct link to a named resource manager is made. The resource manager named in the source must be of the form:

nid,pid,chid,handle

where

nid
Node ID of resource manager to link to.
pid
Process ID of resource manager to link to.
chid
Channel ID of resource manager to link to.
handle
Handle of a pathname prefix of the resource manager to link to.

Most prefix links are symbolic.

Examples:

Create a link to /home/curious/monkey called gorilla in the /home/george directory:

ln /home/curious/monkey /home/george/gorilla

Create a symbolic link to the directory /home/fred called /home/barney:

ln -s  /home/fred /home/barney

Create a symbolic prefix link to /dev/shmem from /tmp. This simple link maps all temporary files created under the /tmp directory into shared memory objects, thus implementing a RAM disk.

ln -sP /dev/shmem /tmp

Create a symbolic prefix to /dev/ser1 from /dev/modem. Any attempt to open /dev/modem results in an open of /dev/ser1.

ln -sP /dev/ser1 /dev/modem

Exit status:

0
All the specified files were linked successfully.
>0
An error occurred.

Caveats:

When creating a symbolic link, ln doesn't check that the source_file named actually exists, or even that it's a valid pathname. If the file doesn't exist or if the source_file isn't a valid pathname, any attempts to use the link fail.


Caution: If a destination path exists, and ln is interrupted before ending, the destination path may be removed before the new link is created.

See also:

cp, ln-w, mv


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/utilities/l/ln.html on line 268

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/utilities/l/ln.html on line 268