If you’re like me you occasionally need to copy a file from a remote Linux/OS X box that you only have SSH access to. I used to use FileZilla because it supports SFTP and allows you to interact with your server as if it were an FTP site. I still recommend this when you need to copy multiple files or are not sure exactly where the stuff your looking for resides. However, for those times when you just need to copy a simple file either to or from your server and you’re already terminal anyway there’s Secure Copy.
To Upload a File to Your Server
Upload shrimpz.rb to yum.rb in Curran’s home directory on server named Jenny using Forrest’s login
scp shrimpz.rb forrest@jenny:/home/curran/yum.rb
If you don’t want to rename the file simply omit the target filename. This upload
shrimpz.rb in Curran’s home directory
scp shrimpz.rb forrest@jenny:/home/curran/
To Download a File from Your Server
Download suitcase.rb from Marsellus’s home directory on server named Wallace using Vega’s login into current directory as
scp vega@wallace:/home/marsellus/suitcase.rb .
To download folders use
scp -r vega@wallace:/home/marsellus/somefolder .
Super Advanced Users
If you’re a super advanced user you may want to checkout SCP’s nerdy big brother rsync.