cp (Unix)

from Wikipedia, the free encyclopedia

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] quelldateizielverzeichnis

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 scpfrom 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

Web links

Wikibooks: Linux-Praxisbuch / cp  - learning and teaching materials