scp Command Builder
Build a correct scp (Secure Copy Protocol) command without confusing flag order or the capital--P gotcha. Choose upload or download direction, enter local and remote paths, set a port, identity file and recursive flag — the command assembles instantly with proper user@host:/path syntax.
How to use the scp Command Builder
Choose the transfer direction: Upload copies from your local machine to a remote server; Download copies from the remote to local. The scp argument order changes accordingly: scp [flags] src dest — the source always comes before the destination.
Enter the local path (a file or directory on your machine) and the remote path (the destination directory or file on the server). The remote path is prefixed with user@host: to form the full SCP address.
Port: scp uses -P (capital P) unlike ssh which uses -p. This is the most common scp mistake. Leave blank for the default port 22. Identity file (-i) specifies the private key to authenticate with. Recursive (-r) copies directories recursively — required when the source is a directory.
Paths with spaces should be quoted; the builder quotes remote paths automatically when they contain spaces. Always test that the remote path exists and you have write permission before running a large transfer.
About scp
scp (Secure Copy Protocol) transfers files between hosts using the SSH protocol for authentication and encryption. It works over the standard SSH port (22) and uses the same key-based or password authentication as SSH. Unlike FTP, scp encrypts both authentication credentials and file data in transit.
The syntax is scp [options] [[user@]host1:]file1 [[user@]host2:]file2. Either the source or the destination (or both) can be remote. A remote location uses user@host:/path syntax — the colon separates the host from the path. Local paths are plain filesystem paths with no colon prefix. You can also copy between two remote hosts (host-to-host) by specifying both source and destination in remote format, though this requires the source host to have SSH access to the destination.
scp's main limitation compared to rsync is that it always transfers the full file — there is no delta algorithm. For repeated transfers of large files that change incrementally, rsync is faster. scp is better for one-off transfers where simplicity matters. Also note: OpenSSH 9.0+ deprecated the legacy SCP protocol in favour of SFTP by default; the command still works but uses SFTP under the hood. Use sftp or rsync -e ssh for more control over large or resumable transfers.
Common use cases
- Uploading build artifacts — copy a compiled binary or dist/ folder to a production server from a CI runner or developer machine.
- Downloading logs — pull application or access logs from a remote server for local analysis without leaving a copy on an intermediary.
- Bootstrapping a new server — copy configuration files, SSH keys or scripts to a fresh server before Ansible or Terraform can run.
- Database backup retrieval — download a compressed database dump from a production server for local import or archiving.
- Cross-host file transfers — move files between two remote servers without first downloading them locally, useful for migrations.