O'Reilly logo

Linux in a Nutshell, 6th Edition by Robert Love, Stephen Figgins, Ellen Siever, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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).

Options

-a, --archive

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

-b, --backup[=control]

Back up files to be overwritten. As -b, takes no argument. For --backup, control specifies the type of backup and can also be set with the environment variable VERSION-CONTROL. The default is existing. Valid arguments are:

t, numbered

Always make numbered backups.

nil, existing

Make numbered backups of files that already have them; otherwise, make simple backups.

never, simple

Always make simple backups.

none, off

Never make backups, even if --backup is specified.

-c

The same as --preserve=context.

--copy-contents

Copy contents of special files when recursive.

-d

The same as --no-dereference --preserve=links.

-f, --force

Remove an existing file in the destination if it can’t be opened. See also --remove-destination.

-H

Follow command-line symbolic links in the source.

-i, --interactive

Prompt before overwriting destination files. On most systems, this flag is turned off by default except for the root user, who is normally prompted before overwriting files.

-l, --link

Make hard links, not copies, of nondirectories.

-L, --dereference

Always follow symbolic links.

--no-preserve ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required