Today I had a problem. I wanted to copy a file between my host computer and the server but without using filezilla or any other FTP client. So I googled a bit for a solution that would enable me to copy/paste the file without ever leaving my terminal.
The solution is called SCP. SCP stands for secure copy. With it you can move files from your server to your host computer and vice versa.
So let’s say you want to upload splash.png file to your server from your host.
You’d simply write
scp splash.png remote_username@remote_serve_ip:/where/you/want/to/put/splash.png
If you wanted to retrieve the file you’d do it like this
scp remote_username@remote_serve_ip:/where/you/want/to/put/splash.png ./
When you’re downloading a file from your remote server just remember that the place where you’re downloading it
to has to be a directory. So
./ couldn’t be replace with let’s say
Also if your server is using a specific port you can specify it with “P” flag.
scp -P your_port_number ...
If you’re trying to copy/paste a folder don’t forget to include “r” flag.
scp -r some_folder ...
This post is on GitHub. If you spot any errors please do a pull request.
comments powered by Disqus