4.4BSD/usr/share/man/cat7/symlink.0

Compare this file to the similar file:
Show the results in this format:

SYMLINK(7)                   BSD Reference Manual                   SYMLINK(7)

NNAAMMEE
     ssyymmlliinnkk - symbolic link handling

SSYYMMBBOOLLIICC LLIINNKK HHAANNDDLLIINNGG
     Because a symbolic link and its referenced object coexist in the filesys-
     tem name space, confusion can arise in distinguishing between the link
     itself and the referenced object.  Traditionally, utilities and system
     calls have adopted their own link following conventions in an ad-hoc
     fashion.  Rules for more a uniform approach are outlined here.

     Symbolic links are handled either by operating on the link itself, or by
     operating on the object referenced by the link.  In the latter case, an
     application or system call is said to ``follow'' the link.  Symbolic
     links may reference other symbolic links, in which case links are deref-
     erenced until an object that is not a symbolic link is found.  Cycles are
     avoided by placing an upper limit on the number of links that may be fol-
     lowed.  An error results if this limit is exceeded.

     There are three domains for which symbolic link policy is established:
     system calls that take file name arguments, utilities that take file name
     arguments, and utilities that traverse file hierarchies.

     The system calls that do not follow symbolic links are lstat(2),
     readlink(2),  rename(2),  and unlink(2).  All other system calls follow
     the symbolic link.  Unlike other filesystem objects, symbolic links do
     not have an owner, group, access mode, times, etc.  Instead, these at-
     tributes are taken from the directory that contains the link.  The only
     attributes returned from an lstat(2) that refer to the symbolic link it-
     self are the file type (S_IFLNK), size, blocks, and link count (always
     1).

     The utilities that do not follow symbolic links named as arguments are
     mv(1) and rm(1).  For compatibility with historic systems, the ls(1)
     utility follows symbolic links listed on the command line, unless the --FF,
     --dd or --ll options are specified.  However, if the --LL option is specified,
     ls(1) always follows symbolic links.  All other utilities follow symbolic
     links listed on the command line.

     The third issue in symbolic link handling is traversal of a file hierar-
     chy.  File hierarchies can be traversed either ``logically'', by follow-
     ing symbolic links that point to directories, or ``physically'', by not
     following such links.

     The following utilities can do traversals: chflags(1),  chgrp(1),
     chmod(1),  chown(8),  cp(1),  du(1),  find(1),  ls(1),  rm(1) and tar(1).
      All these utilities, except for cp,  ls and rm,  operate according to
     the following rules.

     By default, these utilities do a physical traversal, never following any
     symbolic links.  If the --HH option is specified, the utility will follow
     symbolic links specified on the command line.  If the --hh option is speci-
     fied, the utilities do a logical traversal, following all symbolic links
     whether specified on the command line or encountered while descending the
     file hierarchy.  The --HH flag is intended to make the command line name
     space look like the logical name space and the --hh flag is intended to
     make the entire hierarchy look like the logical name space.

     The utilities cp,  ls and rm are exceptions to these rules.

     To maintain compatibility with historic systems, cp always follows sym-
     bolic links on the command line.  The --HH and --hh options have the effects
     described above only when the --RR flag is specified.


     Rm operates on the name, not the object it points to, and therefore never
     follows a symbolic link.  The rm utility does not support the --HH or --hh
     options.

     To maintain compatibility with historic systems, the ls utility follows
     all symbolic links in the file hierarchy, including ones listed on the
     command line, only when the --LL option is specified.  The ls utility does
     not support the --HH or --hh options.

SSEEEE AALLSSOO
     chflags(1),  chgrp(1),  chmod(1),  cp(1),  du(1),  find(1),  ln(1),
     ls(1),  mv(1),  rm(1),  tar(1),  lstat(2),  readlink(2),  rename(2),
     unlink(2),  chown(8)

4th Berkeley Distribution        May 31, 1993                                2