Skip to Main Content
Unix in a Nutshell, 4th Edition
book

Unix in a Nutshell, 4th Edition

by Arnold Robbins
October 2005
Intermediate to advanced content levelIntermediate to advanced
908 pages
46h 42m
English
O'Reilly Media, Inc.
Content preview from Unix in a Nutshell, 4th Edition

Name

cp

Synopsis

    cp [options] file1 file2
cp [options]files 
 directory

Copy file1 to file2, or copy one or more files to the same names under directory. If the destination is an existing file, the file is overwritten; if the destination is an existing directory, the file is copied into the directory (the directory is not overwritten). If one of the inputs is a directory, use the -r option.

Common Options

-f, --force

Remove existing files in the destination.

-i, --interactive

Prompt for confirmation (y for yes) before overwriting an existing file.

-p

Preserve the original file’s permissions, ownership, and timestamps in the new file.

-r, -R, --recursive

Copy directories recursively. Solaris -R replicates named pipes, instead of reading from them.

GNU/Linux and Mac OS X Options

-H

When used with -R, if a command-line argument is a symbolic link to a directory, recursively traverse the directory.

-L, --dereference

When used with -R, if any symbolic link points to a directory, recursively traverse the directory.

-P

When used with -R, do not follow any symbolic links. This is the default.

-v, --verbose

Before copying , print the name of each file.

Solaris Option

-@

Copy extended attributes (ACLs, etc.) along with normal attributes.

GNU/Linux Options

-a, --archive

Preserve attributes of original files where possible. The same as -dpR.

-b

Back up files that would otherwise be overwritten.

--backup[=backup-method]

Like -b, but accepts an additional specification controlling how the backup copy should be made. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning the Unix Operating System, 5th Edition

Learning the Unix Operating System, 5th Edition

John Strang, Grace Todino, Jerry Peek
UNIX and Linux System Administration Handbook, 5th Edition

UNIX and Linux System Administration Handbook, 5th Edition

Trent R. Hein, Evi Nemeth, Garth Snyder, Ben Whaley, Dan Mackin

Publisher Resources

ISBN: 0596100299Errata Page