Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

You must log in to answer this question.

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