I'm connecting from a Linux server (Machine 1) to another Linux server (Machine 2) using PuTTY.

Using WinSCP, I have copied a zip file from my hard disk in Windows to the Machine 1's home directory.

How can I copy this zip file from the Machine 1 to the Machine 2's build/test_builds directory?

link|improve this question
1  
you can use SCP but you don't know how to copy to a particular folder? – Code Monkey Oct 11 '11 at 14:45
ftp, sftp are a couple of others – mikey Oct 11 '11 at 14:45
feedback

migrated from stackoverflow.com Oct 11 '11 at 15:00

This question came from our site for professional and enthusiast programmers.

3 Answers

scp sourcefile ssh://[user]@[hostname]/[destination path]

I think this should work with every linux box with ssh enabled, maybe you'll need to enable secure copy (scp)

A better way to write this can be:

scp source destination

source and destination can be:

  • absolute or relative path to file (eg. /tmp/foo.txt or ./foo.txt)

  • ssh file path (in the form ssh://[user]@[machine]/[path]

You can also perform copies between machine1 and machine2, while being on machine3 (given that you've got access - eg. a logon to each machine) via:

scp ssh://user@machine1/path ssh://user@machine2/path

Hope this helps.

link|improve this answer
Thank you ,please tell me whether this hostname is refering Machiene 1 or Machiene 2 ?? – user974802 Oct 11 '11 at 14:52
hostname is target machine, if you're executing the command on Machine1 will copy Machine1's file to Machine2 – BigMike Oct 11 '11 at 14:55
Thank you Mike . – user974802 Oct 11 '11 at 14:55
feedback
rsync -r --progress SRC DST

works also nice: retransfer, progress-bar

link|improve this answer
feedback

To transfer between two linux boxes use scp like the above user suggested. His syntax is a little off for ssh though. With scp the format is

scp [options] source destination

Which is available in the man pages man scp

for you the syntax from machine 1 is

scp /path/to/file.zip user@ip.of.machine.2:port/path/to/destination/dir/

port default is 22

link|improve this answer
feedback

Your Answer

 
or
required, but never shown