1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Discuss in my forum

Example uses of the Linux Command scp

An Introductory Tutorial


Working on computer
AMV Photo/Digital Vision/Getty Images

The following examples illustrate typical uses of the command scp for securely copying files.

With the scp (secure copy) command you can easily copy from and to a remote computer or between remote computers.

If you want to copy a file "customers.txt" in the directory "/usr/data/" from a computer "tomsnotebook" using account "jdoe" to the current directory, you would type the following at a command line:

scp jdoe@tomsnotebook:/usr/data/customers.txt .

The period "." at the end means "this" directory, that is, the directory from which the command was executed. You could specify any other directory instead. It will ask for the password of the account.

You can copy a complete directory by adding a "-r" after the "scp":

scp -r jdoe@tomsnotebook:/usr/data .

In order to copy several files at once you can use the following syntax:

scp jdoe@tomsnotebook:/usr/data/\{file1.txt,file2.txt,file3.txt\} .

More on scp...

  1. About.com
  2. Technology
  3. Linux
  4. Linux / Shell Commands
  5. Example uses of the Linux Command scp

©2014 About.com. All rights reserved.