76 lines
4.0 KiB
HTML
76 lines
4.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
|
<!Converted with LaTeX2HTML 95.1 (Fri Jan 20 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
|
<HEAD>
|
|
<TITLE>3.10.2 Symbolic links</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value="3.10.2 Symbolic links">
|
|
<meta name="keywords" value="gs">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html3410 HREF="node132.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3408 HREF="node129.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3404 HREF="node130.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3412 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3413 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html3411 HREF="node132.html">3.11 Job Control</A>
|
|
<B>Up:</B> <A NAME=tex2html3409 HREF="node129.html">3.10 Managing file links</A>
|
|
<B> Previous:</B> <A NAME=tex2html3405 HREF="node130.html">3.10.1 Hard links</A>
|
|
<BR> <HR> <P>
|
|
<H2><A NAME=SECTION005102000000000000000>3.10.2 Symbolic links</A></H2>
|
|
<P>
|
|
<A NAME=3348> </A>
|
|
Symbolic links are another type of link, which are somewhat different
|
|
than hard links.
|
|
A symbolic link allows you to give a file another name, but it
|
|
doesn't link the file by inode.
|
|
<P>
|
|
The command <tt>ln -s</tt> will create a symbolic link to a file.
|
|
For example, if we use the command
|
|
<P><TT> # <em>ln -s foo bar</em>
|
|
<P></TT>
|
|
we will create the symbolic link <tt>bar</tt> pointing to the file
|
|
<tt>foo</tt>. If we use <tt>ls -i</tt>, we will see that the two
|
|
files have different inodes, indeed.
|
|
<P><TT> # <em>ls -i foo bar</em> <BR>
|
|
22195 bar 22192 foo <BR>
|
|
#
|
|
<P></TT>
|
|
However, using <tt>ls -l</tt>, we see that the file <tt>bar</tt>
|
|
is a symlink pointing to <tt>foo</tt>.
|
|
<P><TT> # <em>ls -l foo bar</em> <BR>
|
|
<code>lrwxrwxrwx 1 root root 3 Aug 5 16:51 bar -> foo</code> <BR>
|
|
<code>-rw-r--r-- 1 root root 12 Aug 5 16:50 foo</code> <BR>
|
|
#
|
|
<P></TT>
|
|
<P>
|
|
The permission bits on a symbolic link are not used (they always
|
|
appear as <tt>rwxrwxrwx</tt>). Instead, the permissions on the symbolic link
|
|
are determined by the permissions on the target of the symbolic link (in
|
|
our example, the file <tt>foo</tt>).
|
|
<P>
|
|
Functionally, hard links and symbolic links are similar, but
|
|
there are some differences. For one thing,
|
|
you can create a symbolic link to a file which doesn't exist; the
|
|
same is not true for hard links. Symbolic links are processed by
|
|
the kernel differently than hard links are, which is just a
|
|
technical difference but sometimes an important one. Symbolic links
|
|
are helpful because they identify what file they point to; with
|
|
hard links, there is no easy way to determine which files are linked
|
|
to the same inode.
|
|
<P>
|
|
Links are used in many places on the Linux system. Symbolic links
|
|
are especially important to the shared library images in
|
|
<tt>/lib</tt>. See Section <A HREF="node181.html#secupgradelibs">4.7.2</A> for more information.
|
|
<A NAME=3369> </A>
|
|
<A NAME=3370> </A>
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html3410 HREF="node132.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3408 HREF="node129.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3404 HREF="node130.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3412 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3413 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html3411 HREF="node132.html">3.11 Job Control</A>
|
|
<B>Up:</B> <A NAME=tex2html3409 HREF="node129.html">3.10 Managing file links</A>
|
|
<B> Previous:</B> <A NAME=tex2html3405 HREF="node130.html">3.10.1 Hard links</A>
|
|
<BR> <HR> <P>
|
|
<BR> <HR>
|
|
<P><ADDRESS>
|
|
<I>Matt Welsh <BR>
|
|
mdw@sunsite.unc.edu</I>
|
|
</ADDRESS>
|
|
</BODY>
|