scp Command Builder — Linux scp Examples
Linux scp Command Builder (Secure Remote Copy)
The scp command copies files between hosts over SSH. This interactive scp Command Builder helps you generate precise scp commands for uploads and downloads.
🚀 What is the scp Command?
The scp command allows you to:
- Copy files securely over SSH
- Upload local files to a remote host
- Download remote files to your local machine
- Copy between two remote hosts
- Preserve attributes and use custom ports and keys
⚙️ Basic Syntax
scp [options] [[user@]host1:]source_file [[user@]host2:]destination
scp [options] local_path [user@]host:path
scp [options] [user@]host:path local_path🧠 How to Use This scp Command Builder
This tool helps you:
- Choose copy direction (upload vs download)
- Specify remote host, user, and path
- Pick the correct port and identity options
- Generate a ready-to-use scp command
Workflow
- Choose direction: upload or download
- Enter remote user, host, and path
- Set port, key, and extra options
- Copy generated command
🔧 Common scp Usage Patterns
Upload a File to a Remote Host
scp report.pdf user@192.168.1.10:/home/user/docs/Download a File from a Remote Host
scp user@192.168.1.10:/var/log/app.log ./app.logUse a Custom SSH Port
scp -P 2222 backup.tar.gz user@example.com:/backups/Recursive Copy with Compression
scp -r -C ./mysite user@example.com:/var/www/⚠️ Important Notes
- -P vs -p is the #1 scp pitfall: use UPPERCASE
-Pfor port, lowercase-ppreserves timestamps and modes - Direction matters: source first, destination last; a colon means remote
- Overwrites silently: scp overwrites the destination without asking
- Host key checking: first connection prompts to trust the host key
- Useful flags:
-rrecursive,-iidentity file,-Ccompression,-lbandwidth limit,-ossh options
📋 Upload vs Download
| Scenario | Command |
|---|---|
| Upload local to remote | scp file user@host:/path/ |
| Download remote to local | scp user@host:/path/file ./ |
| Custom port upload | scp -P 2222 file user@host:/path/ |
| Recursive directory copy | scp -r dir user@host:/path/ |
✅ Pro Tips
- Always double-check destination paths since overwrites are silent
- Use
-i ~/.ssh/mykey.pemwhen the server needs a specific key - Use
-Cfor text-heavy transfers and-l 1000to limit bandwidth - Test connectivity with
ssh user@hostbefore long transfers