Name

scp local_spec remote_spec — openssh-clients

Synopsis

/usr/bin stdin stdout - file -- opt --help --version

The scp (secure copy) command copies files and directories from one computer to another in batch. (For an interactive user interface, see sftp.) It encrypts all communication between the two machines.

$ scp myfile remote.example.com:newfile
$ scp -r mydir remote.example.com:
$ scp remote.example.com:myfile .
$ scp -r remote.example.com:mydir .

To specify an alternate username on the remote system, use the username@host syntax:

$ scp myfile smith@remote.example.com:

Useful options

-p

Duplicate all file attributes (permissions, timestamps) when copying.

-r

Recursively copy a directory and its contents.

-v

Produce verbose output, useful for debugging.

Get Linux Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.