Vannkorn

Full Stack Web Developer

Close

Using SCP to upload/download files from local/remote

There are times when we need to upload files via command line. Luckily, Mac offers an SCP software built-in unlike Windows that you'll need to install WinSCP.

Ads: Register now via this link to receive $100 credit from Vultr

There are times when we need to upload files via the command line, especially when the file is big and it can’t be done via traditional file transfer software like FTP. Luckily, Mac offers an SCP software built-in unlike Windows that you’ll need to install WinSCP.

To download a file from the remote server to your local machine, open a terminal and run the following command:

scp username@remotecomputer:/locate/the/file/you/want/to/copy /where/to/put/file/on/your/laptop

Then we’ll just need to type the password of that username of the remote server over SSH.

For example, scp root@97.42.3.124:/MyFiles /home/web/site-name/public_html/files

To upload a file to the remote server, simply run the following command:

scp /lcate/the/file/on/your/laptop username@remotecomputer:~/ 

Note that I’ve tried to upload the file to the specific directory on the remote server, but I ended up getting the permission denied message. Thus only ~/ works.

Alternatively, you can also use rsync.

Leave a Reply

Your email address will not be published. Required fields are marked *