Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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.)

share|improve this answer
    
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 '12 at 15:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.