If you are using any VPS or Cloud server, most often you need to copy your files from local to remote. You can transfer your files to remote or from remote to local using SSH(Secure Shell) protocol to access your server. SSH has an awesome scp utility for transferring files to remote servers or vice-versa. You can use sftp and rsync utility also to send over the files to the server. In this tutorial, I am going to explain how to copy file from local to remote server. So, let’s get started.
Prerequisites
- Server IP address
- Server user name
- SSK key or password
Copy File from Local to Remote Server
SCP is the easiest way to transfer or copying the files between remote and local. Let’s have a look at the basic scp command.
$ scp samplefile.txt remote_user@remote_server:/remote_directory/
Above command will copy the samplefile.txt
to the remote_server
location remote_directory
location. When you run above command it will ask for password, if you haven’t added your public key to the server for SSH.
Copy File from Remote to Local Server
To copy files from the server to the local system, use following command.
$ scp remote_user@remote_server:/remote_directory/samplefile.txt /local_directory/
Above command will copy the samplefile.txt
from remote_server
location local_directory
location.
Read more: How to Upload File to AWS EC2 Instance
Conclusion
In this article, you have learned to copy file from local to remote server as well as remote to local. If you have any doubts feel free to contact me, I will definitely try to help you. Also, you can join our elite Facebook group to get direct help from me. If you like this tutorial, please share this article on your social media handle.