How do I use scp backwards?

I want to do the following:

scp [email protected]:/root/file.txt ~/homecomputer/directory

Instead of taking a file from the server though, I would like to send a file. How do I do this?


The syntax is:

scp source destination

So this time the source is your local (client) computer and the destination is the remote (server) computer.

If the file you want to send is ~/homecomputer/directory/foobar.txt, then from your local computer you can do:

scp ~/homecomputer/directory/foobar.txt [email protected]:/where/to/put

Check man scp to get more idea on this.