# Secure Copy Protocol (SCP)
SCP is a file transfer protocol that uses [[Secure Shell (SSH)]] to securely copy files between a local and a remote host, or between two remote hosts. It provides authentication and encryption inherited from SSH — no data is transmitted in the clear.
Basic usage:
```bash
# Copy local file to remote host
scp file.txt user@host:/path/
# Copy remote file to local machine
scp user@host:/path/file.txt .
# Copy recursively
scp -r local_dir/ user@host:/path/
# Copy with a specific SSH port
scp -P 2222 file.txt user@host:/path/
```
SCP is simple and effective for quick one-off file transfers. For more advanced use cases (directory listings, resume, partial transfers), [[SFTP]] or [[rsync]] are better alternatives. Note that [[OpenSSH]] considers SCP deprecated in favor of SFTP, though the `scp` command in modern OpenSSH versions actually uses the SFTP protocol under the hood by default.
## References
- https://man.openbsd.org/scp
## Related
- [[Secure Shell (SSH)]]
- [[OpenSSH]]
- [[SFTP]]
- [[rsync]]
- [[Linux]]