Skip to content

scp command

Copy files between computers over SSH.

On this page

Syntax

scp [options] source… destination

Provided by the openssh-client package. Run man scp for the full manual.

Common options

OptionWhat it does
-rCopy directories
-P PORTSSH port (capital P)
-i FILEPrivate key
-pKeep times and modes
-CCompress during transfer
-l KBITLimit the bandwidth

Examples

  1. Upload a file

    scp backup.tar.gz user@server:/tmp/
  2. Download a file

    scp user@server:/var/log/syslog .
  3. Copy a directory

    scp -r site/ user@server:/var/www/
  4. Use another port

    scp -P 2222 file.txt user@server:~
  5. Use a key

    scp -i ~/.ssh/key.pem app.zip ubuntu@server:~
  6. Between two remote hosts

    scp user@a:/data/file user@b:/data/

Tips

  • For big or repeated copies, rsync is faster and can resume.

scp guides

← All Linux commands · Suggest a fix

Back to top