Copy a local file to a remote directory.
scp report.txt alice@example.com:/tmp/Copy files between hosts over SSH. Check both source and destination paths.
scp [OPTION]... SOURCE... TARGETCopy a local file to a remote directory.
scp report.txt alice@example.com:/tmp/Copy a directory tree using a custom SSH port.
scp -P 2222 -r ./site alice@example.com:/srv/backup/| Option / clause | Description |
|---|---|
-r | Copy directories recursively. |
-P PORT | Connect to the SSH server on PORT (uppercase P). |
-i IDENTITY_FILE | Select the private key file. |
-p | Preserve modification times, access times and modes. |
-C | Enable compression during transfer. |
-q | Suppress progress and diagnostic messages. |
Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.