SCP between Linux machines

Below are the commands used to secure copy files from one Linux machine to another.

Pushing the files from the machine you are typing on, to another machine, requires the following format.

scp -rp filename_here remote_username@remote_machine_name:full_path_to_file

eg. scp -rp data.xml virtualmachine@139.86.35.123:/usr/software/xml_files

Pulling the files from another machine, to the one that you are typing the command on, requires the following format.

scp -rp remote_username@remote_machine_name:full_path_to_file . “This ends with a space then dot (meaning current working directory on machine issuing command)”

scp -pr virtualmachine@139.86.35.123:/usr/software/xml_files .

The -r is used to copy files/folders recursively.

The -p is used to preserve the original time stamps of the file.

more flags:

-P Specifies the port to connect to on the remote machine

for more info type man scp at the command prompt

Advertisements

One thought on “SCP between Linux machines

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s