Online Linux Terminal Logo
OnlineLinuxTerminal
Networking & TransferCLI Reference

$scp

Securely copy files and directories between hosts over SSH connection.

Syntax DefinitionPOSIX standard
scp [OPTIONS] SOURCE DEST
Linux Community2.4k Online

Chat with real Linux users, learn new commands & get free cheat sheet PDFs.

Try `scp` Live in Interactive Sandbox

Zero-install client simulation with real-time feedback.

Open in Fullscreen Workspace↗
bash — terminal

Overview & How scp Works

`scp` (Secure Copy Protocol) transfers files securely between a local host and a remote host, or between two remote servers, using the same authentication and encryption as SSH.

Common Flags & Command Options

Flag / OptionDescription
-rRecursively copy entire directories.
-P [port]Specify port to connect to on the remote host.
-i [keyfile]Identity file for SSH private key authentication.

Practical Real-World Examples

Example #1Copy a local file to remote server
scp notes.txt user@remote-server:/home/user/docs/

Uploads notes.txt to the remote server directory over SSH.

Frequently Asked Questions

Why do developers prefer rsync over scp for large backups?

`rsync` can resume interrupted transfers and only transfers modified delta byte chunks, saving enormous bandwidth.