cp (Unix)
cp
(for copy ) is an internal command of a Unix shell for copying of files on Unix - or Unix-like operating systems on computers.
use
The syntax is kept very simple; Usually a file is copied from source file to target file by typing
cp [Optionen] quelldatei zieldatei
enters. Multiple files can be copied by all file names are specified, then the destination directory :
cp [Optionen] quelldatei … zielverzeichnis
So z. For example, it is possible to use wildcards , which modern Unix shells usually provide. So copied
cp bild*.jpg ziel/
z. B. the files bild1.jpg , bild234.jpg or bild_abc.jpg in the directory target if the shell used expands the wildcard * .
Network-compatible alternatives
A number of programs have developed from the traditional Unix tool that copy files from one Unix computer to the next via the computer network , and in their syntactic usage are closely based on the program cp
.
rcp, ssh
An extension of the cp program is the rcp program, which was created for use in networks ( remote copy ).
The syntax is:
rcp <Dateiname> <entfernter Benutzer@entfernter Rechner:/Verzeichnis/Dateiname>
Due to principle-related security problems - the files are transmitted unencrypted - rcp is strongly discouraged and the use of the successor scp
from the SSH family is recommended instead .
rsync
When it comes to synchronizing two directories and just copying changes, rsync is a widely used replacement for the cp command. It can be used both locally and over the network. When copying over the network, encryption with SSH can be carried out.
See also
- mv (Unix) moves files or renames them and is called with largely identical syntax ...
- ... similar to ln (Unix) for creating links .
- Paragraph file operations in the article Unix commands
Web links
-
cp(1)
: copy files - Open Group Base Specification -
cp(1)
: copy files - OpenBSD General Commands Manual -
cp(1)
: Copying files and directories - Debian GNU / Linux executables or shell commands man page -
cp.c
Source code for GNU / Linuxcp
from coreutils 8.13