The sftp and scp commands

Overview

In the course of your computational biology lifetime, you may need to move files back and forth between UNIX systems that are secured by SSH. The sftp and scp commands are ideal for this task. For those of you using Linux or MacOS X computers, please follow along as we transfer a file from today's exercises to your local system using both commands.

SFTP

Open a new Terminal window and enter the following

  1. sftp YOUR_USERNAME@lonestar.tacc.utexas.edu and enter your password when prompted
  2. cd /corral-repl/utexas/BioITeam/tacc_ngs/
  3. get bowtie-launcher.sh
  4. quit

If all goes according to plan, you will see a file transfer go by quickly, and in your local home directory, the bowtie-launcher.sh file will appear. You can edit it and push it back up to Lonestar (though not to the BioITeam directory!)

Question: How would you upload this local file back to Lonestar using SFTP?

 Solution
  1. sftp YOUR_USERNAME@lonestar.tacc.utexas.edu
  2. cd SOME_DIRECTORY_YOU_OWN
  3. put bowtie-launcher.sh
  4. quit

SCP

SFTP gives you interactive access to the remote and local file systems, but you may know exactly where yo want to copy from and exactly where it needs to go. This is where SCP shines! Here's the sequence of commands for doing the same thing we just did with SFTP but using SCP instead.

  1. scp YOUR_USERNAME@lonestar.tacc.utexas.edu:/corral-repl/utexas/BioITeam/tacc_ngs/bowtie-launcher.sh .

Tough huh? To go the other way...

  1. scp bowtie-launcher.sh YOUR_USERNAME@lonestar.tacc.utexas.edu:

Now, you're a command-line data transfer pro. Make sure to check out the manual pages for sftp and scp and research around a little on the web to learn even more about their usage.