# info > scp

---
type: CommandReference
command: scp
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `scp file.txt user@host:/path/` — copy local file to remote
- `scp user@host:file.txt .` — copy remote file to local
- `scp -r dir/ user@host:/path/` — recursively copy directory
- `scp -P 2222 file user@host:/path/` — specify port
- `scp -i key.pem file user@host:/path/` — use identity file
- `scp -l 1000 file user@host:/path/` — limit bandwidth to 1000 Kbit/s
- `scp -C file user@host:/path/` — enable compression
- `scp -q user@host:file .` — quiet mode, no progress meter

## Name

scp — OpenSSH secure file copy

## Synopsis

`scp [-346ABCOpqRrsTv] [-c cipher] [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-J destination] [-l limit] [-o ssh_option] [-P port] [-S program] source ... target`

## Options

- `-3` — Copies between two remote hosts are transferred through the local host.
- `-4` — Forces IPv4 addresses only.
- `-6` — Forces IPv6 addresses only.
- `-A` — Allows forwarding of `ssh-agent(1)` to the remote system.
- `-B` — Batch mode (prevents asking for passwords or passphrases).
- `-c cipher` — Selects cipher for data transfer encryption.
- `-C` — Compression enable (passes `-C` to `ssh(1)`).
- `-D sftp_server_path` — Connect directly to a local SFTP server program (with `-s`).
- `-F ssh_config` — Specifies alternative per-user ssh configuration file.
- `-i identity_file` — Selects identity (private key) for public key authentication.
- `-J destination` — Connect via jump host(s). Multiple hops comma-separated.
- `-l limit` — Limits bandwidth in Kbit/s.
- `-O` — Use original SCP protocol (default).
- `-o ssh_option` — Pass options to ssh in `ssh_config(5)` format.
- `-P port` — Specifies port to connect on remote host (capital P).
- `-p` — Preserves modification times, access times, and file mode bits.
- `-q` — Quiet mode: disables progress meter and diagnostic messages.
- `-R` — Copies between two remote hosts by connecting to origin host and executing scp there.
- `-r` — Recursively copy entire directories.
- `-s` — Use SFTP protocol for transfers.
- `-S program` — Program to use for encrypted connection.
- `-T` — Disable strict filename checking (trust server).
- `-v` — Verbose mode: prints debugging messages.

## Examples

shell
# Copy local file to remote host
scp file.txt user@host:/remote/directory/

# Copy remote file to local directory
scp user@host:file.txt /local/directory/

# Recursively copy a directory
scp -r /local/dir/ user@host:/remote/dir/

# Copy using a specific port
scp -P 2222 file.txt user@host:/remote/

# Copy using an identity file (private key)
scp -i ~/.ssh/id_rsa file.txt user@host:/remote/

# Limit bandwidth to 1000 Kbit/s
scp -l 1000 file.txt user@host:/remote/

# Enable compression
scp -C file.txt user@host:/remote/

# Quiet mode (no progress meter)
scp -q user@host:file.txt /local/
## See Also

- [sftp(1)](https://man.openbsd.org/sftp.1)
- [ssh(1)](https://man.openbsd.org/ssh.1)
- [ssh-add(1)](https://man.openbsd.org/ssh-add.1)
- [ssh-agent(1)](https://man.openbsd.org/ssh-agent.1)
- [ssh-keygen(1)](https://man.openbsd.org/ssh-keygen.1)
- [ssh_config(5)](https://man.openbsd.org/ssh_config.5)
- [sftp-server(8)](https://man.openbsd.org/sftp-server.8)
- [sshd(8)](https://man.openbsd.org/sshd.8)

## Exit Codes

- `0` — Success
- `>0` — Error occurred