O'Reilly logo

Linux Pocket Guide, 2nd Edition by Daniel J. Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

scp — stdin  stdout  - file  -- opt  --help  --version

Synopsis

scp local_spec remote_spec

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. As a simple example, scp can copy a local file to a remote machine:

$ scp myfile remote.example.com:newfile

recursively copy a directory to a remote machine:

$ scp -r mydir remote.example.com:

copy a remote file to your local machine:

$ scp remote.example.com:myfile .

or recursively copy a remote directory to your local machine:

$ 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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required