I want to do the following:

scp root@server.ip.adress:/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?


2 Answers 2


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 root@server.ip.adress:/where/to/put

Check man scp to get more idea on this.


If you want to send a file FROM a server TO your local computer, then exactly what you suggested works, IF you run this from your LOCAL computer, NOT your REMOTE server:

scp root@server.ip.adress:/root/file.txt ~/homecomputer/directory

Here, root@server.ip.adress:/root/file.txt is your source and ~/homecomputer/directory your destination.

NOTE: This answer assumes that you don't need some private key to SSH into your server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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