Linux Scroll

Just another WordPress.com site

SCP – Secure Copy Remote File

Copy a file to remote host:

$ scp -P sshport /path/file1 remotehostusername@remotehostIP:/tmp/file1

Example:

$ scp -P 22 /tmp/doc root@192.168.1.1:/tmp/doc

Note: Using ssh to copy doc to remote host at /tmp/doc.

Copy file on remote host to my computer:

$ scp -r -P sshport remotehostusername@remotehostIP:/tmp/file2 /tmp/file2

Example:

$ scp -r -P 22 root@192.168.1.1:/tmp/doc2 /home/%username%/Desktop/doc2

Note: Using ssh to copy doc2 from remote host to my computer at Desktop/doc2.

Advertisements

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

%d bloggers like this: