{
    "mode": "man",
    "parameter": "scp",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/scp/1/json",
    "generated": "2026-09-18T14:26:31Z",
    "synopsis": "scp  [-346ABCOpqRrsTv]  [-c  cipher] [-D sftpserverpath] [-F sshconfig] [-i identityfile]\n[-J destination] [-l limit] [-o sshoption]  [-P  port]  [-S  program]  [-X  sftpoption]\nsource ... target",
    "sections": {
        "NAME": {
            "content": "scp — OpenSSH secure file copy\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "scp  [-346ABCOpqRrsTv]  [-c  cipher] [-D sftpserverpath] [-F sshconfig] [-i identityfile]\n[-J destination] [-l limit] [-o sshoption]  [-P  port]  [-S  program]  [-X  sftpoption]\nsource ... target\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "scp copies files between hosts on a network.\n\nscp  uses the SFTP protocol over a ssh(1) connection for data transfer, and uses the same au‐\nthentication and provides the same security as a login session.\n\nscp will ask for passwords or passphrases if they are needed for authentication.\n\nThe source and target may be specified as a local pathname, a remote host with optional  path\nin  the form [user@]host:[path], or a URI in the form scp://[user@]host[:port][/path].  Local\nfile names can be made explicit using absolute or relative pathnames to  avoid  scp  treating\nfile names containing ‘:’ as host specifiers.\n\nWhen  copying between two remote hosts, if the URI format is used, a port cannot be specified\non the target if the -R option is used.\n\nThe options are as follows:\n",
            "subsections": [
                {
                    "name": "-3",
                    "content": "option the data is copied directly between the two remote hosts.  Note that, when us‐\ning the legacy SCP protocol (via the -O flag), this option selects batch mode for the\nsecond host as scp cannot ask for passwords or passphrases for both hosts.  This mode\nis the default.\n",
                    "flag": "-3"
                },
                {
                    "name": "-4",
                    "content": "",
                    "flag": "-4"
                },
                {
                    "name": "-6",
                    "content": "",
                    "flag": "-6"
                },
                {
                    "name": "-A",
                    "content": "ward an authentication agent.\n",
                    "flag": "-A"
                },
                {
                    "name": "-B",
                    "content": "",
                    "flag": "-B"
                },
                {
                    "name": "-C       -C",
                    "content": "",
                    "flag": "-C"
                },
                {
                    "name": "-c _",
                    "content": "Selects  the cipher to use for encrypting the data transfer.  This option is directly\npassed to ssh(1).\n",
                    "flag": "-c"
                },
                {
                    "name": "-D _",
                    "content": "Connect directly to a local SFTP server program rather than a remote one via  ssh(1).\nThis option may be useful in debugging the client and server.\n",
                    "flag": "-D"
                },
                {
                    "name": "-F _",
                    "content": "Specifies  an  alternative  per-user  configuration file for ssh.  This option is di‐\nrectly passed to ssh(1).\n",
                    "flag": "-F"
                },
                {
                    "name": "-i _",
                    "content": "Selects the file from which the identity (private key) for public key  authentication\nis read.  This option is directly passed to ssh(1).\n",
                    "flag": "-i"
                },
                {
                    "name": "-J _",
                    "content": "Connect  to  the  target  host by first making an scp connection to the jump host de‐\nscribed by destination and then establishing a TCP forwarding to the ultimate  desti‐\nnation  from  there.   Multiple jump hops may be specified separated by comma charac‐\nters.  This is a shortcut to specify a ProxyJump configuration directive.   This  op‐\ntion is directly passed to ssh(1).\n",
                    "flag": "-J"
                },
                {
                    "name": "-l _",
                    "content": "Limits the used bandwidth, specified in Kbit/s.\n",
                    "flag": "-l"
                },
                {
                    "name": "-O",
                    "content": "the  use of the SCP protocol may be necessary for servers that do not implement SFTP,\nfor backwards-compatibility for particular filename wildcard patterns and for expand‐\ning paths with a ‘~’ prefix for older SFTP servers.\n",
                    "flag": "-O"
                },
                {
                    "name": "-o _",
                    "content": "Can be used to pass options to ssh in the format used in sshconfig(5).  This is use‐\nful for specifying options for which there is no separate scp command-line flag.  For\nfull  details  of  the  options  listed  below,  and  their  possible   values,   see\nsshconfig(5).\n\nAddressFamily\nBatchMode\nBindAddress\nBindInterface\nCanonicalDomains\nCanonicalizeFallbackLocal\nCanonicalizeHostname\nCanonicalizeMaxDots\nCanonicalizePermittedCNAMEs\nCASignatureAlgorithms\nCertificateFile\nCheckHostIP\nCiphers\nCompression\nConnectionAttempts\nConnectTimeout\nControlMaster\nControlPath\nControlPersist\nGlobalKnownHostsFile\nGSSAPIAuthentication\nGSSAPIDelegateCredentials\nHashKnownHosts\nHost\nHostbasedAcceptedAlgorithms\nHostbasedAuthentication\nHostKeyAlgorithms\nHostKeyAlias\nHostname\nIdentitiesOnly\nIdentityAgent\nIdentityFile\nIPQoS\nKbdInteractiveAuthentication\nKbdInteractiveDevices\nKexAlgorithms\nKnownHostsCommand\nLogLevel\nMACs\nNoHostAuthenticationForLocalhost\nNumberOfPasswordPrompts\nPasswordAuthentication\nPKCS11Provider\nPort\nPreferredAuthentications\nProxyCommand\nProxyJump\nPubkeyAcceptedAlgorithms\nPubkeyAuthentication\nRekeyLimit\nRequiredRSASize\nSendEnv\nServerAliveInterval\nServerAliveCountMax\nSetEnv\nStrictHostKeyChecking\nTCPKeepAlive\nUpdateHostKeys\nUser\nUserKnownHostsFile\nVerifyHostKeyDNS\n",
                    "flag": "-o"
                },
                {
                    "name": "-P _",
                    "content": "Specifies  the port to connect to on the remote host.  Note that this option is writ‐\nten with a capital ‘P’, because -p is already reserved for preserving the  times  and\nmode bits of the file.\n",
                    "flag": "-P"
                },
                {
                    "name": "-p",
                    "content": "",
                    "flag": "-p"
                },
                {
                    "name": "-q",
                    "content": "from ssh(1).\n",
                    "flag": "-q"
                },
                {
                    "name": "-R",
                    "content": "executing scp there.  This requires that scp running on the origin host can authenti‐\ncate to the destination host without requiring a password.\n",
                    "flag": "-R"
                },
                {
                    "name": "-r",
                    "content": "tered in the tree traversal.\n",
                    "flag": "-r"
                },
                {
                    "name": "-S _",
                    "content": "Name of program to use for the encrypted connection.   The  program  must  understand\nssh(1) options.\n",
                    "flag": "-S"
                },
                {
                    "name": "-T",
                    "content": "to a local directory scp checks that the received filenames match those requested  on\nthe command-line to prevent the remote end from sending unexpected or unwanted files.\nBecause of differences in how various operating systems and shells interpret filename\nwildcards,  these checks may cause wanted files to be rejected.  This option disables\nthese checks at the expense of fully trusting that the server  will  not  send  unex‐\npected filenames.\n",
                    "flag": "-T"
                },
                {
                    "name": "-v",
                    "content": "progress.  This is helpful in debugging connection, authentication, and configuration\nproblems.\n",
                    "flag": "-v"
                },
                {
                    "name": "-X _",
                    "content": "Specify an option that controls aspects of SFTP protocol behaviour.   The  valid  op‐\ntions are:\n\nnrequests=value\nControls  how  many concurrent SFTP read or write requests may be in progress\nat any point in time during a download or upload.  By default 64 requests may\nbe active concurrently.\n\nbuffer=value\nControls the maximum buffer size for a single SFTP read/write operation  used\nduring download or upload.  By default a 32KB buffer is used.\n",
                    "flag": "-X"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "The scp utility exits 0 on success, and >0 if an error occurs.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "sftp(1),  ssh(1),  ssh-add(1),  ssh-agent(1),  ssh-keygen(1),  sshconfig(5), sftp-server(8),\nsshd(8)\n",
            "subsections": []
        },
        "HISTORY": {
            "content": "scp is based on the rcp program in BSD source code from the Regents of the University of Cal‐\nifornia.\n\nSince OpenSSH 9.0, scp has used the SFTP protocol for transfers by default.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Timo Rinne <tri@iki.fi>\nTatu Ylonen <ylo@cs.hut.fi>\n",
            "subsections": []
        },
        "CAVEATS": {
            "content": "The legacy SCP protocol (selected by the -O flag) requires execution  of  the  remote  user's\nshell  to  perform glob(3) pattern matching.  This requires careful quoting of any characters\nthat have special meaning to the remote shell, such as quote characters.\n\nDebian                                    December 16, 2022                                   SCP(1)",
            "subsections": []
        }
    },
    "summary": "scp — OpenSSH secure file copy",
    "flags": [
        {
            "flag": "-3",
            "long": null,
            "arg": null,
            "description": "option the data is copied directly between the two remote hosts. Note that, when us‐ ing the legacy SCP protocol (via the -O flag), this option selects batch mode for the second host as scp cannot ask for passwords or passphrases for both hosts. This mode is the default."
        },
        {
            "flag": "-4",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-6",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-A",
            "long": null,
            "arg": null,
            "description": "ward an authentication agent."
        },
        {
            "flag": "-B",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-C",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-c",
            "long": null,
            "arg": null,
            "description": "Selects the cipher to use for encrypting the data transfer. This option is directly passed to ssh(1)."
        },
        {
            "flag": "-D",
            "long": null,
            "arg": null,
            "description": "Connect directly to a local SFTP server program rather than a remote one via ssh(1). This option may be useful in debugging the client and server."
        },
        {
            "flag": "-F",
            "long": null,
            "arg": null,
            "description": "Specifies an alternative per-user configuration file for ssh. This option is di‐ rectly passed to ssh(1)."
        },
        {
            "flag": "-i",
            "long": null,
            "arg": null,
            "description": "Selects the file from which the identity (private key) for public key authentication is read. This option is directly passed to ssh(1)."
        },
        {
            "flag": "-J",
            "long": null,
            "arg": null,
            "description": "Connect to the target host by first making an scp connection to the jump host de‐ scribed by destination and then establishing a TCP forwarding to the ultimate desti‐ nation from there. Multiple jump hops may be specified separated by comma charac‐ ters. This is a shortcut to specify a ProxyJump configuration directive. This op‐ tion is directly passed to ssh(1)."
        },
        {
            "flag": "-l",
            "long": null,
            "arg": null,
            "description": "Limits the used bandwidth, specified in Kbit/s."
        },
        {
            "flag": "-O",
            "long": null,
            "arg": null,
            "description": "the use of the SCP protocol may be necessary for servers that do not implement SFTP, for backwards-compatibility for particular filename wildcard patterns and for expand‐ ing paths with a ‘~’ prefix for older SFTP servers."
        },
        {
            "flag": "-o",
            "long": null,
            "arg": null,
            "description": "Can be used to pass options to ssh in the format used in sshconfig(5). This is use‐ ful for specifying options for which there is no separate scp command-line flag. For full details of the options listed below, and their possible values, see sshconfig(5). AddressFamily BatchMode BindAddress BindInterface CanonicalDomains CanonicalizeFallbackLocal CanonicalizeHostname CanonicalizeMaxDots CanonicalizePermittedCNAMEs CASignatureAlgorithms CertificateFile CheckHostIP Ciphers Compression ConnectionAttempts ConnectTimeout ControlMaster ControlPath ControlPersist GlobalKnownHostsFile GSSAPIAuthentication GSSAPIDelegateCredentials HashKnownHosts Host HostbasedAcceptedAlgorithms HostbasedAuthentication HostKeyAlgorithms HostKeyAlias Hostname IdentitiesOnly IdentityAgent IdentityFile IPQoS KbdInteractiveAuthentication KbdInteractiveDevices KexAlgorithms KnownHostsCommand LogLevel MACs NoHostAuthenticationForLocalhost NumberOfPasswordPrompts PasswordAuthentication PKCS11Provider Port PreferredAuthentications ProxyCommand ProxyJump PubkeyAcceptedAlgorithms PubkeyAuthentication RekeyLimit RequiredRSASize SendEnv ServerAliveInterval ServerAliveCountMax SetEnv StrictHostKeyChecking TCPKeepAlive UpdateHostKeys User UserKnownHostsFile VerifyHostKeyDNS"
        },
        {
            "flag": "-P",
            "long": null,
            "arg": null,
            "description": "Specifies the port to connect to on the remote host. Note that this option is writ‐ ten with a capital ‘P’, because -p is already reserved for preserving the times and mode bits of the file."
        },
        {
            "flag": "-p",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-q",
            "long": null,
            "arg": null,
            "description": "from ssh(1)."
        },
        {
            "flag": "-R",
            "long": null,
            "arg": null,
            "description": "executing scp there. This requires that scp running on the origin host can authenti‐ cate to the destination host without requiring a password."
        },
        {
            "flag": "-r",
            "long": null,
            "arg": null,
            "description": "tered in the tree traversal."
        },
        {
            "flag": "-S",
            "long": null,
            "arg": null,
            "description": "Name of program to use for the encrypted connection. The program must understand ssh(1) options."
        },
        {
            "flag": "-T",
            "long": null,
            "arg": null,
            "description": "to a local directory scp checks that the received filenames match those requested on the command-line to prevent the remote end from sending unexpected or unwanted files. Because of differences in how various operating systems and shells interpret filename wildcards, these checks may cause wanted files to be rejected. This option disables these checks at the expense of fully trusting that the server will not send unex‐ pected filenames."
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": "progress. This is helpful in debugging connection, authentication, and configuration problems."
        },
        {
            "flag": "-X",
            "long": null,
            "arg": null,
            "description": "Specify an option that controls aspects of SFTP protocol behaviour. The valid op‐ tions are: nrequests=value Controls how many concurrent SFTP read or write requests may be in progress at any point in time during a download or upload. By default 64 requests may be active concurrently. buffer=value Controls the maximum buffer size for a single SFTP read/write operation used during download or upload. By default a 32KB buffer is used."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "sftp",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/sftp/1/json"
        },
        {
            "name": "ssh",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ssh/1/json"
        },
        {
            "name": "ssh-add",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ssh-add/1/json"
        },
        {
            "name": "ssh-agent",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ssh-agent/1/json"
        },
        {
            "name": "ssh-keygen",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ssh-keygen/1/json"
        },
        {
            "name": "sshconfig",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/sshconfig/5/json"
        },
        {
            "name": "sftp-server",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/sftp-server/8/json"
        },
        {
            "name": "sshd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/sshd/8/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Secure copy.",
        "examples": [
            {
                "description": "Copy a local file to a remote host",
                "command": "scp {{path/to/local_file}} {{remote_host}}:{{path/to/remote_file}}"
            },
            {
                "description": "Use a specific port when connecting to the remote host",
                "command": "scp -P {{port}} {{path/to/local_file}} {{remote_host}}:{{path/to/remote_file}}"
            },
            {
                "description": "Copy a file from a remote host to a local directory",
                "command": "scp {{remote_host}}:{{path/to/remote_file}} {{path/to/local_directory}}"
            },
            {
                "description": "Recursively copy the contents of a directory from a remote host to a local directory",
                "command": "scp -r {{remote_host}}:{{path/to/remote_directory}} {{path/to/local_directory}}"
            },
            {
                "description": "Copy a file between two remote hosts transferring through the local host",
                "command": "scp -3 {{host1}}:{{path/to/remote_file}} {{host2}}:{{path/to/remote_directory}}"
            },
            {
                "description": "Use a specific username when connecting to the remote host",
                "command": "scp {{path/to/local_file}} {{remote_username}}@{{remote_host}}:{{path/to/remote_directory}}"
            },
            {
                "description": "Use a specific SSH private key for authentication with the remote host",
                "command": "scp -i {{~/.ssh/private_key}} {{path/to/local_file}} {{remote_host}}:{{path/to/remote_file}}"
            },
            {
                "description": "Use a specific proxy when connecting to the remote host",
                "command": "scp -J {{proxy_username}}@{{proxy_host}} {{path/to/local_file}} {{remote_host}}:{{path/to/remote_file}}"
            }
        ]
    }
}