December 04, 2015

How to Download or Upload Files via SSH / SCP

Too lazy to download a specialized FTP app? No worries. You can download or upload files to your server directly via your terminal / SSH with these few simple commands.

To download from the server

$ scp [email protected]:/var/www/remote_file.txt local_file.txt

With custom port number (eg. 2222):
$ scp -P 2222 [email protected]:/var/www/remote_file.txt local_file.txt

To upload to the server

$ scp local_file.txt [email protected]:/var/www/remote_file.txt

With custom port number (eg. 2222):
$ scp -P 2222 local_file.txt [email protected]:/var/www/remote_file.txt

That's all!

***

Hello! My name is Jian Jye and I work on Laravel projects as my main job. If my article was helpful to you, a shoutout on Twitter would be awesome! I'm also available for hire if you need any help with Laravel. Contact me.