Simplified manual page for scp
(Unix command line)
SYNOPSIS:
scp [-p] [-v] [-r] [[username@]host:]file ... [[username@]host:]file_or_dir
Copies files over the network securely; uses ssh for data transfer, using the same authentication and providing the same security as ssh.
EXAMPLES of USAGE
(The ``.colorado.edu'' isn't necessary ifboth computers are on the Boulder campus.
Typing a username isn't necessary if you have
the same username on both computers.)
1. ``Putting'' a single file
ucsu> scp mydata.dat newton.colorado.edu:NewData.txt
copy file ``mydata.dat'' from your current computer/directory to your home directory on newton.colorado.edu,
naming the copy on newton ``NewData.txt''.
ucsu> scp mydata.dat newton.colorado.edu:
same thing, but the copied file on newton is named the same as the original (mydata.dat) by default
ucsu> scp mydata.dat amath:/www/courses/8100/2005Spr/lab2.dat
copy file to a specific directory on amath, giving the file a new name there
goldhill.ucar.edu> scp mydata.dat smithjz@amath.colorado.edu:ncar.dat
copy file from your account on goldhill to your home directory on amath,
where your username is different (smithjz)
2. ``Getting'' a single file
ucsu> scp newton:mydata.dat ./mydata.dat
copies file ``mydata.dat'' from the your home directory on newton to
your current working directory on ucsu
ucsu> scp newton:mydata.dat ./
same thing -- it is enough just to indicate the directory (`` ./'' = my current directory), and
the copied file will be named the same as the original, by default
ucsu> scp smithjz@newton.colorado.edu:research/MYC/mydata.dat ./
gets the file from my ``research/MYC'' subdirectory (relative to smithjz's home directory on newton)
3. ``Putting'' an entire directory
ucsu> scp -r research newton:MyRsrch/09/
copy directory ``research'' recursively (i.e., the directory and all its contents) from ucsu
into a new directory ``MyRsrch/09/'' in your home directory on newton
(the directory ``MyRsrch'' must already exist).
Sometimes a better alternative is to create a tar file, then copy over
only that single tar file and unpack it on the remote host.
4. ``Getting'' an entire directory
ucsu> scp -r smithj@euclid.ucla.edu:MyRsrch/09 ./r9/
copy directory ``MyRsrch/09/'' recursively (i.e., the directory and all its contents) from
euclid.ucla.edu (where you are "smithj" into a new directory ``r9/'' in your current working directory on ucsu.
Sometimes a better alternative is to ssh to the remote computer, bundle the
files you want into a single tar file, scp that file over, and unpack it where you want the files.
OPTIONS:
-r This option specifies that scp should copy directories recursively -- copies all the files & subdirectories,
plus the contents of the subdirectories themselves, etc. The operation does not follow symbolic links.
-p Tells scp to preserve file attributes and timestamps.
-v Makes scp verbose.
full manual page for scp
NAME scp - secure copy (remote file copy program) SYNOPSIS scp [-pqrvBC46] [-F ssh_config] [-S program] [-P port] [-c cipher] [-i identity_file] [-o ssh_option] [[user@]host1:]file1 [...] [[user@]host2:]file2 DESCRIPTION for data transfer, and uses the same authentication and pro- vides the same security as ssh(1). Unlike rcp(1), scp will ask for passwords or passphrases if they are needed for authentication. Any file name may contain a host and user specification to indicate that the file is to be copied to/from that host. Copies between two remote hosts are permitted. The options are as follows: -c cipher Selects the cipher to use for encrypting the data transfer. This option is directly passed to ssh(1). -i identity_file Selects the file from which the identity (private key) for RSA authentication is read. This option is directly passed to ssh(1). -p Preserves modification times, access times, and modes from the original file. -r Recursively copy entire directories. -v Verbose mode. Causes scp and ssh(1) to print debugging messages about their progress. This is helpful in debugging connection, authentication, and configuration problems. -B Selects batch mode (prevents asking for passwords or passphrases). -q Disables the progress meter. -C Compression enable. Passes the -C flag to ssh(1) to enable compression. -F ssh_config Specifies an alternative per-user configuration file for ssh. This option is directly passed to ssh(1). -P port Specifies the port to connect to on the remote host. Note that this option is written with a capital `P', because -p is already reserved for preserving the times and modes of the file in rcp(1). -S program Name of program to use for the encrypted connection. The program must understand ssh(1) options. -o ssh_option Can be used to pass options to ssh in the format used in ssh_config(5). This is useful for specifying options for which there is no separate scp command-line flag. For example, forcing the use of protocol version 1 is specified using scp -oProtocol=1. -4 Forces scp to use IPv4 addresses only. -6 Forces scp to use IPv6 addresses only.