Back to the command reference

scp

NetworkFundamentals In real Linux

Copy files between machines over SSH

Name: scp = secure copy

This command needs a real Linux system; you can practise it in real Linux mode.

Description

scp copies files between hosts over SSH, much like cp, with remote paths written user@host:path. Transfers are encrypted. For many files or incremental syncs rsync is more efficient.

Syntax

scp [OPTION]... SOURCE... TARGET

Common options

-rCopy directories
-P PORTPort (capital P)
-i KEYFILEIdentity file
-pKeep modification times and modes
-CCompress the transfer
-l LIMITLimit the bandwidth, in Kbit/s
-J JUMPHOSTGo through a jump host
-qNo progress meter

Examples

  • $ scp report.txt backup01:/srv/backup/

    Copy a local file to backup01

    Explain
  • $ scp backup01:/etc/os-release .

    Fetch a file from backup01 into the current directory

    Explain
  • $ scp -r site/ backup01:/srv/backup/

    Copy a whole directory

    Explain

Related