The basic syntax for the SCP command is offered down below:
[email protected]:/path/to/desired destination/listing
/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 nextcloud-21..1.zip to the remote host’s dwelling directory /property/bob. The IP of the host is 192.168.2.103 and bob is the login person.
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.
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:
In the instance underneath, we are copying the file revenue.pdf from the remote system to the area program:
Equally, you can copy a listing from the distant host to the area method employing the -r flag as demonstrated.
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.