Skip to content
BENIBIX Learn

scp

Infrastructure🔑 SSH & Remote AccessFile Transfer

Also known as scp Command, Secure Copy, Secure Copy Protocol

A command that copies a file to or from a server. It goes over SSH.

Think of it like

Think of it like posting one parcel through a locked chute. It lands on the far side, and that is it.

Example

Emma needs one report on her server. She types one scp line, and the file is there a second later.

Why it matters

It is the quickest way to move one file when you already have SSH access.

Definition

scp copies files between two computers over SSH. You name the file, then where it should go, with a colon after the server's address. It uses the same login and keys as ssh. It copies the whole file every time. Since OpenSSH 9.0 it moves the data with the SFTP protocol underneath.

Example code

bash
scp report.pdf emma@203.0.113.10:/home/emma/
Copy one file from the laptop to Emma's home on the server.
In the scp lane, one file goes across once. It is a single copy, then done.

Common mistake

Leaving out the colon after the address. Then scp makes a file on your own computer instead.

Key takeaways

  1. 1
    Over SSH. Same login, same keys.
  2. 2
    Whole file. Copies all of it each time.
  3. 3
    Mind the colon. It marks the far side.

Compare

Learn it properly