Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cp(1) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1)

cpio(1)

ln(1)

mv(1)

pax(1)

rm(1)

cp(1)                                                                 cp(1)

NAME
     cp - copy files

SYNOPSIS
     cp [-f] [-i] [-p] [--] file copyfile                          Format 1

     cp [-f] [-i] [-p] [-R|-r] [--] file ... directory             Format 2

DESCRIPTION
     cp makes a physical copy (duplicate) of one or more files.

     There are two ways to copy with cp. The command can copy either:

     -  one file to another with a different name (Format 1), or

     -  one or more files to a different directory, with the copy retaining
        the same basename as the corresponding original (Format 2).

OPTIONS
   Format 1: Copy one file

     cp [-f] [-i] [-p] [--] file copyfile

     -f   (forced) If copyfile already exists and a file descriptor cannot
          be obtained (e.g. no write permission), cp deletes the file and
          recreates it as a copy.

     -i   (interactive) If the named copyfile already exists, cp will ask
          you to confirm whether this file may be overwritten. A y answer
          means that the copy should proceed. Any other answer prevents cp
          from overwriting copyfile.

          If the standard input is not a terminal, this option is ignored
          and no copying is done.

     -p   cp will also duplicate the following characteristics of file:

          -  Modification date and date of last access

          -  User and user group

          -  Access permissions

     --   If file begins with a dash (-), the end of the command-line
          options must be marked with --.










Page 1                       Reliant UNIX 5.44                Printed 11/98

cp(1)                                                                 cp(1)

     When the Veritas File System (VxFS) is installed on the system, the
     following additional option is available:

     -e extentop
            Specify how to process extent attribute information. This
            option specifies the required persistence of extent attributes
            when processing files which have preallocated space or fixed
            extent sizes. Valid values for extentop are:

            warn     issue a warning message if extent attribute informa-
                     tion cannot be kept (the default behavior if this
                     option is not specified).

            force    fail the move if extent attribute information cannot
                     be kept.

            ignore   ignore extent attribute information.

     file   Name of the original file.

     copyfile
            Name of the copy file.

            If copyfile does not yet exist, a new file is created.

            Unless the -p option is used, the copy will have the access
            permissions of the original, modified by the current file-
            creation mode mask, and the user and group ID of the copy will
            be those of the user who called cp. But the time of last modif-
            ication of the copy will be set to the time the copy was made.

            Caution:

            If a file named copyfile already exists and the -i option is
            not used, the existing file will be overwritten without confir-
            mation, but its mode, owner, and group will be preserved.

            If copyfile is a link to a file, all links will be retained.
            The contents of copyfile will be overwritten with the contents
            of file.

   Format 2: Copy files to another directory

     cp [-f] [-i] [-p] [-R|-r] [--] file ... directory

     -f     (f - forced). If file already exists in directory and a file
            descriptor cannot be obtained (e.g. no write permission), cp
            deletes the file and recreates it as a copy.






Page 2                       Reliant UNIX 5.44                Printed 11/98

cp(1)                                                                 cp(1)

     -i     (interactive) If the named file already exists, cp will ask you
            to confirm whether this file may be overwritten. A y answer
            means that the copy should proceed. Any other answer prevents
            cp from overwriting copyfile.

     -p     cp will also duplicate the following characteristics of file:

            -  Modification date and date of the last access

            -  User and user group

            -  Access permissions

     -R|-r  (recursive) If file is a directory, cp will copy the directory
            and all its files, including any subdirectories and their
            files. Please note that -R or -r are not suitable for copying
            pipes.

     --     If file begins with a dash (-), the end of the command-line
            options must be marked with --.

     When the Veritas File System (VxFS) is installed on the system, the
     following additional option is available:

     -e extentop
            Specify how to process extent attribute information. This
            option specifies the required persistence of extent attributes
            when processing files which have preallocated space or fixed
            extent sizes. Valid values for extentop are:

            warn     issue a warning message if extent attribute informa-
                     tion cannot be kept (the default behavior if this
                     option is not specified).

            force    fail the move if extent attribute information cannot
                     be kept.

            ignore   ignore extent attribute information.

     file   Name of the original file. You can give a list of names and
            thus copy several files at once. Each of the copies is assigned
            the same basic filename (basename) as the corresponding origi-
            nal.

            Caution:

            If there is a file in directory with the same basename as any
            original, and the -i option has not been set, the existing file
            will be overwritten without confirmation.





Page 3                       Reliant UNIX 5.44                Printed 11/98

cp(1)                                                                 cp(1)

     directory
            Name of the directory in which the copies are to be placed.
            This must not be the directory in which the original files are
            located.

            Unless the -p option is set, the copies will have die access
            permissions of the original, modified by the current file-
            creation mode mask, and the user and group ID of the copies
            will be those of the user who called cp. The time of last
            modification of each copy will be set to the time the copy was
            made.

ERROR MESSAGES

     cp: cannot access file

     The named file does not exist.

     cp: cannot open file

     You have no read permission for file.

     cp: cannot create file

     You do not have write permission for the directory in which file is to
     be created, or the named directory does not exist.

     cp: <dir> directory

     dir is a directory and cannot be copied (Format 1), or you have not
     set the -R|-r option (Format 2).

LOCALE
     The LCMESSAGES environment variable governs the language in which
     message texts are displayed. If LCMESSAGES is undefined or is defined
     as the null string, it defaults to the value of LANG. If LANG is like-
     wise undefined or null, the system acts as if it were not internation-
     alized.

     Answers to yes/no queries must be given in the language appropriate to
     the current locale.

EXAMPLES
     Example 1

     The file techlit is to be copied before it is changed. The copy is to
     be called tl and to be located in the same directory as techlit.

     $ cp techlit tl





Page 4                       Reliant UNIX 5.44                Printed 11/98

cp(1)                                                                 cp(1)

     Example 2

     All files from the current directory with names beginning with file
     are to be copied into the directory /home/do/save, and their times of
     last modification are to be duplicated.

      $ cp -p fil* /home/do/save
      $ ls -l /home/do/save
      total 4
      -rw------  1  dober  gr1        37 Nov 11 11:11  file1
      -rw------  1  dober  gr1        97 Apr 01 13:24  file2
      -rw------  1  dober  gr1       116 Dec 31 12:13  file3
      -rw------  1  dober  gr1       381 Feb 16 08:08  file4

SEE ALSO
     chmod(1), cpio(1), ln(1), mv(1), pax(1), rm(1).






































Page 5                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026