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.

This command does nothing.

scp doc.txt user@mywebsite.com

This command, however, copies doc.txt into the home directory of my website.

scp doc.txt user@mywebsite.com:

Why doesn't the first command (without a colon) work?

share|improve this question
2  
You're wrong about the first command. It in fact does something: copies doc.txt to user@mywebsite.com. –  criziot Jul 15 '12 at 0:57
2  
To clarify why you get downvotes on your question: it does not show any "research effort" which is required on this site, inasmuch as reading man scp would have given you the answer. –  Daniel Andersson Jul 15 '12 at 14:08
add comment

3 Answers

up vote 5 down vote accepted

According to the man page for scp:

[user@]host1:]file1

The host needs a colon to indicate that it's remote.

share|improve this answer
add comment

scp can be used locally. The colon is how it distinguishes between a local copy and a remote copy. BTW that first one probably does something - copy doc.txt to a file called "user@mywebsite.com"

share|improve this answer
add comment

The name user@mywebsite.com is a valid name on the local filesystem. scp like rcp before it uses the colon character to seperate the remote user and hostname from the remote path.

Or to put it differently, that is just the way the program was written.

share|improve this answer
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.