1

I have 2 Linux machines (CentOS), and I want to transfer a file from one of them to a directory on the other. A co-worker suggested using scp. I've looked at the official docs, and tried getting it to work to no avail.

Server names are thing1.me.org and thing2.me.org; if I am on thing1, and want to SSH into thing2, I just type the following command, and I'm in.

 ssh thing2.me.org

I tried doing the same for SCP, and had no luck. I tried all sorts of variants, but I'm getting nowhere.

scp myfile.txt thing2.me.org/opt/app/
scp myfile.txt ssh://thing2.me.org/opt/app

Do you have any advice?

1 Answer 1

4

The scp syntax is host:file, so you want

scp myfile.txt thing2.me.org:/opt/app/

(If the target path is empty does not start with a /, it will be relative to your home directory.)

1
  • You can also do it completely without sshing into thing1 at all. scp thing1.me.org:/path/to/myfile.txt thing2.me.org:/opt/app/
    – Rob
    Feb 3, 2012 at 15:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .