Copy the file "foobar.txt" from a remote host to the local host:
$ scp your_username@remotehost.edu:foobar.txt /some/local/directory
Copy the file "foobar.txt" from the local host to a remote host:
$ scp foobar.txt your_username@remotehost.edu:/some/remote/directory
Copy the directory "foo" from the local host to a remote host's directory "bar":
$ scp -r foo your_username@remotehost.edu:/some/remote/directory/bar
Copy the file "foobar.txt" from remote host "rh1.edu" to remote host "rh2.edu":
$ scp your_username@rh1.edu:/some/remote/directory/foobar.txt your_username@rh2.edu:/some/remote/directory/
Copying the files "foo.txt" and "bar.txt" from the local host to your home directory on the remote host:
$ scp foo.txt bar.txt your_username@remotehost.edu:~
Copy the file "foobar.txt" from the local host to a remote host using port 2264:
$ scp -P 2264 foobar.txt your_username@remotehost.edu:/some/remote/directory
Copy multiple files from the remote host to your current directory on the local host:
$ scp your_username@remotehost.edu:/some/remote/directory/\{a,b,c\} .
$ scp your_username@remotehost.edu:~/\{foo.txt,bar.txt\} .
For More Information: Secure Copy
Nobody seems to mention which computer to execute this command on – braks – 2016-01-06T00:04:34.653
Thanks, I'll give it a try and confirm if it worked for me. – user98496 – 2011-09-20T14:10:25.590
1I think the question is more about setting up dyndns and port forwarding...he just didn't know what to ask. – RobotHumans – 2011-09-20T14:22:42.793
1True, I probably don't know what to ask. I'm still learning. If you could offer further explanation about what ports I need to forward (and any info I'll need regarding dyndns) in order to achieve my goal, I'd appreciate it:-) – user98496 – 2011-09-20T15:31:33.897
Suggestion in first response did not work. Normally, when I type: "scp -r somedir me@123.45.6.7:/home/me/Desktop" it works fine. However, If I try this from a public WIFI connection at say, Starbucks (and not at home), it doesn't work. What am I doing wrong? – user98496 – 2011-09-20T18:59:42.573
oh right. ok that's a different issue. You need to allow access to ssh from outside your network. This is done by forwarding a port on the your broadband router to the lan ip of your server. However there's some security concerns with allowing ssh access from outside, so you may also want to look into methods to secure ssh, particually key-based authentication and disable password authentication entirely. – Sirex – 2011-09-21T07:51:02.750
I must be missing something here because I am already able to ssh into my server from the outside...never a problem. I just can't scp files from the server when I login from outside. Sorry if I seem confused, but well...I am. – user98496 – 2011-09-23T01:24:35.497
6SOLVED: The command that works for me is: scp remoteusername@host:fileiwanttocopy /my/local/comp – user98496 – 2011-10-19T18:28:52.153