ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahz_5.4.0.1/ln.htm

116 lines
3.2 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content=
"text/html; charset=utf-8">
<title>ln - Link files</title>
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</HEAD>
<body bgcolor="#FFFFFF">
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h2>ln - Link files</h2>
<strong>Synopsis</strong>
<p><strong>ln [-fs]</strong> <em>source_file</em>
[<em>target_file</em>]</p>
<p><strong>ln [-fs]</strong> <em>source_file ...</em>
[<em>target_dir</em>]</p>
<p><strong>Description</strong></p>
<p>The <strong>ln</strong> utility creates a new directory entry
(linked file) which has the same modes as the original file. It is
useful for maintaining multiple copies of a file in many places at
once without using up storage for the copies. Instead, a link
"points to" the original copy. There are two types of links: hard
links and symbolic links. How a link "points to" a file is one of
the differences between a hard or symbolic link.</p>
<p>By default <strong>ln</strong> makes 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 normally refer to
directories and may not span file systems.</p>
<p>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.</p>
<p>Given one or two arguments, <strong>ln</strong> creates a link
to an existing file <em>source_file</em>. If <em>target_file</em>
is given, the link has that name. <em>Target_file</em> may also be
a directory in which to place the link. Otherwise it is placed in
the current directory. If only the directory is specified, the link
will be made to the last component of <em>source_file</em>.</p>
<p>Given more than two arguments, <strong>ln</strong> makes links
in <em>target_dir</em> to all the named source files. The links
made will have the same name as the files being linked to.</p>
<p><strong>Options</strong></p>
<dl>
<dt><strong>-f</strong></dt>
<dd>Unlink any already existing file, permitting the link to
occur.</dd>
<dt><strong>-s</strong></dt>
<dd>Create a symbolic link.</dd>
</dl>
<p><strong>Exit Status</strong></p>
<ul>
<li>0 when success</li>
<li>&gt;0 when an error occurs</li>
</ul>
<p><strong>Related information</strong></p>
<ul>
<li><a href="cp.htm">cp - Copy files</a></li>
<li><a href="ls.htm">ls - List directory contents</a></li>
<li><a href="mv.htm">mv - Move files</a></li>
<li><a href="rm.htm">rm - Remove directory entries</a></li>
<li><a href="rmdir.htm">rmdir - Remove directories</a></li>
</ul>
<strong>Examples</strong>
<ol>
<li>Create a symbolic link from the file, "/usr/bin/perl5" to the
file "/usr/bin/perl".
<pre>
ln -s /usr/bin/perl5 /usr/bin/perl
</pre>
</li>
<li>Create a new link from the file "/usr/bin/qsh" to the file
"/bin/qsh" and unlink the file "/bin/qsh" if it exists.
<pre>
ln -f /usr/bin/qsh /bin/qsh
</pre>
</li>
</ol>
<!-- end ibmbody========================================================= -->
</body>
</html>