How to Upload File from Local to Server using SSH?

July 14, 2020 | Category : PHP

Now, let's see tutorial of how to upload file to server using ssh. This article goes in detailed on how to upload files to vps server using command line. We will look at example of upload file from local machine to linux server. you will learn how to upload file from local to server using ssh.

Sometime we have large file on our local machine and we want to upload it on our linux server then you can not upload using any file system from project. But you need to upload it directly on server.

So, if you just access your vps linux server using ssh then you can do it easily. i will help you how to transfer file form local to server via ssh. so let's see bellow two way to upload your local machine file to server.

You can easily upload file from macOS or Linux.

Using scp

scp -r /path/local/files root@:0.0.0.0:/path/on/my/server

/path/local/files: this is the path of local file that you want to upload on server.

root: this is a username of your linux server.

0.0.0.0: this is a ip address of your linux server.

/path/on/my/server: this is the path of server folder where you upload file on server.

Using rsync

rsync -avz /path/local/files root@:0.0.0.0:/path/on/my/server

/path/local/files: this is the path of local file that you want to upload on server.

root: this is a username of your linux server.

0.0.0.0: this is a ip address of your linux server.

/path/on/my/server: this is the path of server folder where you upload file on server.

I hope it can help you...