Skip to content

Secure Copy Protocol (SCP)

Scp - secure copy (remote file copy program)

Syntax

scp [options] source destination

Options

  • -r: Recursively copy entire directories.
  • -P: Specify the port number to connect to the remote host.
  • -p: Preserves the modification and access times, as well as the permissions of the source-file in the destination-file.
  • -q: Disables the progress meter.
  • -v: Verbose mode.
  • -C: Compress the data before sending it to the destination host.
  • -i: Specify the identity file to use for public key authentication.
  • -l: Limit the bandwidth used for the transfer.
  • -B: Run scp in the background.
  • -F: Specify an alternative configuration file.
  • -S: Specify the program to use for the encrypted connection.
  • -4: Forces scp to use IPv4 addresses only.
  • -6: Forces scp to use IPv6 addresses only.
  • -c: Selects the cipher to use for encrypting the data transfer.

Examples

Copy file from local to remote with port

scp -P 22 /path/to/file user@remote:/path/to/remote

Copy file from local to remote with compression

scp -C /path/to/file user@remote:/path/to/remote

Copy file from local to remote with specific identity file

scp -i /path/to/identityfile /path/to/file user@remote:/path/to/remote

Copy file from local to remote recursively

scp -r /path/to/directory user@remote:/path/to/remote

Copy file from local to remote with progress meter

scp -q /path/to/file user@remote:/path/to/remote

Copy file from local to remote in background

scp -B /path/to/file user@remote:/path/to/remote

Copy file from local to remote with modification and access times

scp -p /path/to/file user@remote:/path/to/remote

Copy file from remote to local

scp user@remote:/path/to/file /path/to/local