Technology and General Blog

The SCP command, an acronym for safe duplicate, is a command used for securely copying data files to and from a distant procedure above SSH protocol. Using on SSH implies that it enjoys the identical amount of data encryption that SSH delivers and is hence regarded as a risk-free way of transferring information across two remote hosts. This tutorial will concentration on the SCP command and emphasize a number of case in point usages.

Primary Syntax

The basic syntax for the SCP command is offered down below:

$ scp [option] /path/to/source/file
[email protected]:/path/to/desired destination/listing

In which:

/route/to/supply/file – This is the source file that you intend to copy to the distant host.

[email protected]: – This is the username and IP handle of the remote method. Get thorough note of the colon that appears just after the IP tackle. 

/path/to/spot/directory: – This is the spot directory on the distant process where the file will be copied to.

The SCP Command Also Will come With the Adhering to Command Options

-C – This compresses the file or listing throughout the copying system.

-P –  Use this solution to specify the SSH port if the default SSH port is not set to 22.

-r –  This solution recursively copies a directory together with its contents.

-r –  Preserves the access and modification instances of the file currently being copied.

Copy a File to a Remote Linux Server

To duplicate a file with no choices, simply just use the syntax revealed. In the case in point underneath, I am copying the zip file to the remote host’s dwelling directory  /property/bob. The IP of the host is and bob is the login person.

$ scp  [email protected]:/house/bob

To duplicate a directory, invoke the -r flag as demonstrated. Here, we are copying the bashtop listing to the dwelling directory of the remote node.

$ scp -r bashtop  [email protected]:/house/bob

Copy a File From a Distant Technique to a Neighborhood Technique

Furthermore, a person can copy a file from the distant node to the nearby method as revealed:

$ scp [option] [email protected]:/route/to/resource/file/path/to/local/listing

In the instance underneath, we are copying the file revenue.pdf from the remote system to the area program:

$ scp [email protected]:/dwelling/bob/product sales.pdf  /household/winnie

Equally, you can copy a listing from the distant host to the area method employing the -r flag as demonstrated.

$ scp -r [email protected]:/household/bob/experiences_2020  /home/winnie

For a lot more solutions on the usage of the SCP command, check out the male webpages:


The Linux SCP command is a handy and safe way of transferring data files in between two distant nodes with out having to be concerned about attackers snooping on your details.

Leave a Reply

Your email address will not be published. Required fields are marked *