commands
cp
Copy files to another place on the same server.
Syntax
Section titled “Syntax”cp <remote-file>... <remote-target>Duplicates files on the server without downloading them. The last argument says where the copies go:
- a directory, written with a trailing
/(/srv/backup/), keeps the names; - a plain name (
index.old) gives a single copy that name; - an operation mask (
*.bak) renames each copy. See operation masks.
You can combine a directory with a name or mask: /srv/backup/*.bak.
The sources may contain masks too. cp does not replace a file that
already exists at the target.
The server must support copying: SFTP servers with the copy extension, or any server where linscp can open a shell.
Affected by
Section titled “Affected by”failonnomatch (see option).
Examples
Section titled “Examples”cp /var/www/html/index.html /var/www/html/index.html.origcp /etc/nginx/*.conf /home/alice/nginx-backup/