commands
scp — Copy files over SSH
Copy files with SSH authentication; SFTP is default from OpenSSH 9.0. -P sets port, -p preserves specified timestamps and modes, -r recursively copies. Verify destination and host first; zero indicates success. Use a fresh private workspace; live operations are VM-only.
Formal Syntax & Structure
linux syntaxlinux
scp [OPTIONS] SOURCE DESTINATIONParameters & Attributes
| Name | Type | Description |
|---|---|---|
| SOURCE | operand | Source path |
| DESTINATION | operand | Destination path |
| -P | option | Port |
| -p | option | Preserve times and modes |
Return Value
exit status and output
Copy files with SSH authentication; SFTP is default from OpenSSH 9.0. -P sets port, -p preserves specified timestamps and modes, -r recursively copies. Verify destination and host first; zero indicates success.
Working Example
Example Snippetlinux
scp -o StrictHostKeyChecking=yes -o UserKnownHostsFile=./known_hosts source/note.txt learner@lab-server.example:incoming/