Show Contents / Index / Search

scp Command Line Options

The scp syntax is:

scp [-a [arg]] [-b buffer_size] [-c cipher] [-d] [-D debug_level] [-F file] [-h] [-i file] [-N max_requests] [-o option] [--overwrite] [-p]

Options are available in both a single-character form (such as -o) and a descriptive equivalent (--option). Single characters are shown here. To view the descriptive equivalents, use the -h command line option.

-a [newline_type]

Transfers files in ASCII mode. Use the optional argument to handle newline conversion. You can specify either `unix' or `dos'. By default, the value you specify for newline_type sets the destination newline convention, but you can specify either source or destination conventions by prefixing the argument with `src:' or `dest:'. For example:

scp -a src:unix ľa dest:dos unixhost:src_file winhost:dest_file

Defaults are: `dest:unix', `src:unix'. If destination and source types are the same, no conversion occurs. Otherwise a conversion occurs based on values you specify for the `src' and `dest' newline types.

-b buffer_size

Specifies the buffer size used for data transfer. The default is 32768 bytes. The minimum allowed value is 1024. The maximum value is limited by the amount of physical memory on your computer. In most cases the default value provides close to optimal transfer speeds. On some systems, moderate increases to the buffer size can improve performance. Caution: Using very large buffer sizes rarely improves performance and can create problems including: slower transfers, transfer failures with servers that don't support very large buffers, and fatal errors when client or server memory limits are exceeded.

-c cipher

Specifies one or more (comma-separated) encryption algorithm supported by the client. The client and server agree on a cipher during the key exchange portion of the connection process. The client presents a list of supported ciphers in order of preference. The cipher used for a given session is the first item in this list that is also supported by the server. Allowed values are `aes128-cbc', `blowfish-cbc', `arcfour', `arcfour128', `arcfour256', `aes192-cbc', `aes256-cbc', `cast128-cbc', and `3des-cbc'.

You can also set this value to `none'. When `none' is the agreed on cipher, data is not encrypted. Note that this method provides no confidentiality protection, and is not recommended.

The following values are provided for convenience: `aes' (which combines `aes128-cbc', `aes192-cbc', and `aes256-cbc'), `blowfish' (equivalent to `blowfish-cbc'), `cast' (equivalent to `cast128-cbc'), `3des' (equivalent to `3des-cbc'), `Any' or `AnyStd' (all available ciphers plus `none'), and `AnyCipher' or `AnyStdCipher' (all available ciphers).

If no cipher is specified, the cipher is determined by the Ciphers keyword in the Secure Shell configuration file ssh2_config(5); the default is `AnyStdCipher'.


Forces the destination to be a directory that already exists. For example, the following command copies source_file to the directory called destination if this directory exists. If the directory doesn't exist, source_file is copied to the demo directory and given the file name destination.

scp source_file joe@myhost:~/demo/destination

With the -d flag added, the following command copies source_file to the destination directory, but fails if this directory doesn't exist.

scp -d source_file joe@myhost:~/demo/destination

-D debug_level

Sets the debug level. Increasing the value increases the amount of information displayed. Use 1, 2, 3, or 99. (Values 4-98 are accepted, but are equivalent to 3.)

-F file

Specifies an additional configuration file. Settings are read from this file in addition to the default user-specific file ($HOME/.ssh2/ssh2_config and/or the system-wide file (/etc/ssh2/ssh2_config). Settings in this file override settings in both the user-specific file and the system-wide file.


Displays a brief summary of command options.

-i file

Specifies an alternate identification file to use for public key authentication. The file location is assumed to be in the current working directory unless you specify a fully-qualified or relative path. The default identity file is $HOME/.ssh2/identification.

-N max_requests

Specifies the maximum number of concurrent requests. Increasing this may slightly improve file transfer speed, but also increases memory use. The default is 16.

-o option

Sets any option that can be configured using a configuration file keyword. For a list of keywords and their meanings, see ssh2_config(5). Syntax alternatives are shown below. Use quotation marks to contain expressions that include spaces.

-o key1=value

-o key1="sample value"

-o "key1 value"

To configure multiple options, use multiple -o switches.

-o key1=value -o key2=value

--overwrite [yes|no|ask]

Specifies whether or not to overwrite existing destination files. The allowed values are `yes', `no', and `ask'. The default is `yes'.


Preserves the modification times and file attributes of the original file.

-P port

Specifies the port to connect to on the server. The default is 22, which is the standard port for Secure Shell connections. You can also configure the port in the configuration file using the Port keyword.


Runs in quiet mode. Only fatal errors are displayed.


Disables display of the progress indicator.


Copies recursively, including all subdirectories.


Deletes the source file after the copy to the destination location is completed.


Sets the debug level to verbose mode, which is equivalent to setting the debug level to 2. You can also configure this in the configuration file using the VerboseMode keyword.


Displays product name and version information and exits. If other options are specified on the command line, they are ignored.

Related Topics

Secure File Copy (scp)