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.
$ 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 email@example.com: /home/local
You must be logged in to post a comment.