SCP Command Linux: How to Copy Another Server File

Here’s the SCP command in Linux copies file from remote server (another server).

SCP (secure copy protocol) and CP (copy protocol) are two commands in use to copy files. The CP is to copy files within the local server, and the SCP command is to copy the remote server’s file.

The SCP command is interesting one. For instance, the source is available in prod, and to copy the same to the test region, you can use SCP.

Linux CP command: Copy file within the local server

Here source and destination are two directories located in the same local server. In the source directory, a file called test.txt is present. Below you’ll find how the CP command copies the file (in the same server).

Linux SCP command: Copy file from another server

The SCP command helps you copy the remote server’s file. To understand the SCP command, focus first on the syntax. Here are the parameters present. VIZ: File to copy, user name, remote server address, and local path.

Advertisements
$ scp [file_to_be_copied] user_name@[remote_server_name/address_of_server]: [local_server_path]

Say, I have a file sample.txt in the remote server xx.xx.xx.xx. I want to copy the same to the local path (/home/local). Here the abcd is the user name. The complete command tells how the SCP works to copy a remote file.

$ scp sample.txt abcd@xx.xx.xx.xx: /home/local

Tips: I have gone through some of the best manuals and Udemy courses. Here’s the best SCP manual and Udemy course. These helpful for your ready reference.

Related

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.