scp
Linux
Windows
Networking
scp copies files between hosts on a network. It uses ssh for data transfer, and uses the same authentication and provides the same security as a login session.
Options
Option | Description |
---|---|
-P port | Specifies the port to connect to on the remote host. |
-p | Preserves modification times, access times, and file mode bits from the source file. |
-r | Recursively copy entire directories. |
Usage
Copy a file from a source host to a target host.
scp sourceuser@sourcehost:/source/path targetuser@targethost:/target/path
scp scp://sourceuser@sourcehost/source/path scp://targetuser@targethost:/target/path
Copy an entire directory from a source host to a target host.
scp -r sourceuser@sourcehost:/source/path targetuser@targethost:/target/path
scp -r scp://sourceuser@sourcehost/source/path scp://targetuser@targethost:/target/path
Copy a file from a source host to a target host specifying the port on the remote host, by default 22 (ssh default port).
scp -P 22000 sourceuser@sourcehost:/source/path targetuser@targethost:/target/path
scp scp://sourceuser@sourcehost:22000/path scp://targetuser@targethost:/target/path