Linux Terminal Command: scp
The scp command is an essential tool in Network Utilities. In this tutorial, we will explore what scp does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.
Concept & Explanation
The scp command copies files securely between remote hosts using SSH encryption protocols.
Common Options & Syntax
scp [options] [arguments]
Here are the most common flags used with scp:
- Simple Usage: Basic default commands.
- Detailed View: Shows diagnostic information.
- Advanced Actions: Can chain parameters for scripting.
1. Interactive Example (Simple)
Here is how most people run the command:
# Example
scp document.pdf user@host.com:/var/www/uploads/
What it does: Copies a local PDF to a remote directory path.
2. Power-User Example (Advanced)
For scripting and advanced diagnostics, use this configuration:
# Advanced
scp -P 2222 -r -C ./project user@host.com:~/backup/
What it does: Copies a folder recursively (-r), compresses data streams to speed up copying (-C), using port 2222 (-P).
⚙️ Warning & Common Pitfalls
[!WARNING]
scpdoes not support resuming interrupted transfers or delta copying. For copying large directories,rsyncis a much better choice.
🔗 Related Commands
Here are some related posts on cli_tty1 you might want to check out:
- rsync : Fast, versatile, remote (and local) file-copying tool.