Сравнивайте с английским: нажмите на абзац — оригинал откроется в окне. Кнопка EN под абзацем показывает его прямо в тексте.
Содержание
Введение
Командная утилита Unix
Unix command utility
В информатике, `cp` — это команда в различных операционных системах Unix и подобных Unix для копирования файлов и каталогов. Команда имеет три основных режима работы, определяемых типами аргументов, передаваемых программе для копирования файла в другой файл, одного или нескольких файлов в каталог, или для копирования целых каталогов в другой каталог. Утилита также принимает различные флаги параметров командной строки для уточнения выполняемых операций. Существуют две основные спецификации: POSIX `cp` и GNU `cp`. GNU `cp` имеет множество дополнительных опций по сравнению с версией POSIX. Команда также доступна в EFI shell.
In computing, cp is a command in various Unix and Unix like operating systems for copying files and directories. The command has three principal modes of operation, expressed by the types of arguments presented to the program for copying a file to another file, one or more files to a directory, or for copying entire directories to another directory. The utility further accepts various command line option flags to detail the operations performed. The two major specifications are POSIX cp and GNU cp. GNU cp has many additional options over the POSIX version. The command is also available in the EFI shell.
История
cp был частью Unix версии 1. Версия команды cp, входящая в состав GNU coreutils, была написана Торбьорном Гранлундом, Дэвидом Маккензи и Джимом Мейерингом.
cp was part of Version 1 Unix. The version of cp bundled in GNU coreutils was written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.
Режимы работы
cp имеет три основных режима работы. Эти режимы определяются типом и количеством аргументов, переданных программе при запуске. Если программе передано два аргумента – имена путей к файлам, программа копирует содержимое первого файла во второй файл, создавая второй файл при необходимости. Если программе передано одно или несколько имен путей к файлам, за которыми следует имя пути к каталогу, программа копирует каждый исходный файл в каталог назначения, создавая отсутствующие файлы. Если аргументы программы – имена путей к двум каталогам, cp копирует все файлы из исходного каталога в каталог назначения, создавая необходимые файлы и каталоги. Для этого режима работы требуется дополнительный флаг опции, обычно r, для указания рекурсивного копирования каталогов. Если каталог назначения уже существует, источник копируется внутрь него, а если не существует – создается новый каталог.
cp has three principal modes of operation. These modes are inferred from the type and count of arguments presented to the program upon invocation. When the program has two arguments of path names to files, the program copies the contents of the first file to the second file, creating the second file if necessary. When the program has one or more arguments of path names of files and following those an argument of a path to a directory, then the program copies each source file to the destination directory, creating any files not already existing. When the program's arguments are the path names to two directories, cp copies all files in the source directory to the destination directory, creating any files or directories needed. This mode of operation requires an additional option flag, typically r, to indicate the recursive copying of directories. If the destination directory already exists, the source is copied into the destination, while a new directory is created if the destination does not exist.