📄 cp.doc
字号:
`cp': Copy files and directories
================================
`cp' copies files (or, optionally, directories). The copy is
completely independent of the original. You can either copy one file to
another, or copy arbitrarily many files to a destination directory.
Synopsis:
cp [OPTION]... SOURCE DEST
cp [OPTION]... SOURCE... DIRECTORY
If the last argument names an existing directory, `cp' copies each
SOURCE file into that directory (retaining the same name). Otherwise,
if only two files are given, it copies the first onto the second. It
is an error if the last argument is not a directory and more than two
non-option arguments are given.
Generally, files are written just as they are read. For exceptions,
see the `--sparse' option below.
By default, `cp' does not copy directories (see `-r' below).
`cp' generally refuses to copy a file onto itself, with the
following exception: if `--force --backup' is specified with SOURCE and
DEST identical, and referring to a regular file, `cp' will make a backup
file, either regular or numbered, as specified in the usual ways. This
is useful when you simply want to make a backup of an existing file
before changing it.
The program accepts the following options.
`--help'
Print a usage message listing all available options, then exit
successfully.
`--version'
Print the version number, then exit successfully.
`-a'
`--archive'
Preserve as much as possible of the structure and attributes of the
original files in the copy (but do not preserve directory
structure). Equivalent to `-dpR'.
`-b'
`--backup'
Make a backup of each file that would otherwise be overwritten or
removed.
`-d'
`--no-dereference'
Copy symbolic links as symbolic links rather than copying the
files that they point to, and preserve hard links between source
files in the copies.
`-f'
`--force'
Remove existing destination files.
`-i'
`--interactive'
Prompt whether to overwrite existing regular destination files.
`-l'
`--link'
Make hard links instead of copies of non-directories.
`-p'
`--preserve'
Preserve the original files' owner, group, permissions, and
timestamps.
`-P'
`--parents'
Form the name of each destination file by appending to the target
directory a slash and the specified name of the source file. The
last argument given to `cp' must be the name of an existing
directory. For example, the command:
cp --parents a/b/c existing_dir
copies the file `a/b/c' to `existing_dir/a/b/c', creating any
missing intermediate directories.
`-r'
Copy directories recursively, copying any non-directories and
non-symbolic links (that is, FIFOs and special files) as if they
were regular files. This means trying to read the data in each
source file and writing it to the destination. It is usually a
mistake to apply `cp -r' to special files like FIFOs and the ones
typically found in the `/dev' directory. In most cases, `cp -r'
will hang indefinitely trying to read from FIFOs and special files
like `/dev/console', and it will fill up your destination disk if
you use it to copy `/dev/zero'. Use the `--recursive' (`-R')
option instead if you want to copy special files, preserving their
special nature rather than reading from them to copy their
contents.
`-R'
`--recursive'
Copy directories recursively, preserving non-directories (contrast
with `-r' just above).
`--sparse=WHEN'
A "sparse file" contains "holes"--a sequence of zero bytes that
does not occupy any physical disk blocks; the `read' system call
reads these as zeroes. This can both save considerable disk space
and increase speed, since many binary files contain lots of
consecutive zero bytes. By default, `cp' detects holes in input
source files via a crude heuristic and makes the corresponding
output file sparse as well.
The WHEN value can be one of the following:
`auto'
The default behavior: the output file is sparse if the input
file is sparse.
`always'
Always make the output file sparse. This is useful when the
input file resides on a filesystem that does not support
sparse files (the most notable example is `efs' filesystems
in SGI IRIX 5.3 and earlier), but the output file is on
another type of filesystem.
`never'
Never make the output file sparse. If you find an
application for this option, let us know.
`-s'
`--symbolic-link'
Make symbolic links instead of copies of non-directories. All
source file names must be absolute (starting with `/') unless the
destination files are in the current directory. This option merely
results in an error message on systems that do not support
symbolic links.
`-u'
`--update'
Do not copy a nondirectory that has an existing destination with
the same or newer modification time.
`-v'
`--verbose'
Print the name of each file before copying it.
`-x'
`--one-file-system'
Skip subdirectories that are on different filesystems from the one
that the copy started on. However, mount point directories _are_
copied.
`-S SUFFIX'
`--suffix=SUFFIX'
Append SUFFIX to each backup file made with `-b'. If this option
is not specified, the value of the `SIMPLE_BACKUP_SUFFIX'
environment variable is used. And if `SIMPLE_BACKUP_SUFFIX' is not
set, the default is `~', just as in Emacs.
`-V METHOD'
`--version-control=METHOD'
Use METHOD to determine the type of backups made with `-b'. If
this option is not specified, the value of the `VERSION_CONTROL'
environment variable is used. And if `VERSION_CONTROL' is not set,
the default backup type is `existing'.
This option corresponds to the Emacs variable `version-control';
the same values for METHOD are accepted as in Emacs. This options
also more descriptive name. The valid METHODs (unique
abbreviations are accepted):
`t'
`numbered'
Always make numbered backups.
`nil'
`existing'
Make numbered backups of files that already have them, simple
backups of the others.
`never'
`simple'
Always make simple backups.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -