Network
scp
Secure copy files between hosts over SSH.
Synopsis
syntax
scp [OPTION]... SOURCE DEST
Examples
Copy file to remote server
scp file.txt user@host:/tmp/
Copy file from remote server
scp user@host:/var/log/app.log .
Copy directory recursively
scp -r project/ user@host:~/
Copy using non-standard port
scp -P 2222 file.txt user@host:/data/
Common options
| Flag | Description |
|---|---|
| -r | Recursively copy directories |
| -P | Port number |
| -i | Identity file |
| -C | Enable compression |
| -p | Preserve modification times and modes |
About scp
The `scp` command secure copy files between hosts over SSH. Networking commands handle connectivity testing, DNS resolution, data transfer, remote access, firewall rules, and traffic analysis.
Linux is the dominant server operating system, and strong networking skills are essential for web hosting, container orchestration, security auditing, and infrastructure management. The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man scp`).
The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Network Commands
Other commands in the Network category