Upload files with ssh / scp in Linux

R

Rob

Guest
Throughout the day, you'll probably find yourself needing to upload files to various sites/servers. A great secure way to quickly move files around from server to server is to use the scp command.

Let's say you need to copy a picture of a donut into your document root on server3.

Code:
 $ scp /home/rob/pictures/donuts/half-eaten.jpg rob@server3:/home/mywebsite.com/public_html/images/

Now, the picture "half-eaten.jpg" is on the mywebsite.com website in the images directory.. Let's work through the command:

scp = our Linux command

/home/rob/pictures/donuts/ = the directory where half-eaten.jpg resides

half-eaten.jpg = our file

rob@server3 = our username on server3

/home/mywebsite.com/public_html/images/ = the directory on server3 where we'd like to put the image

Let's try another one - say you need to grab the logo from that site so you can add a picture of a donut to it in gimp..
Code:
 $ scp rob@server3:/home/mywebsite.com/public_html/images/mylogo.png /home/pictures/[/COLOR][/COLOR][/COLOR]
[COLOR=#000000][COLOR=#000000][COLOR=#000000]


This will grab the logo and put it in your /home/pictures/ directory.

This is a lot more fun if you have SSH keys set up, we also recommend using screen if you're going to be uploading things that may take a while.
 

Members online


Latest posts

Top