Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Working with remote files

scp (secure copy)

The cp command only copies files/directories with the local host's file systems. The scp command is similar to cp, but scp lets you securely copy files from one machine to another. And also like cp, scp has a -r (recursive) option to copy directories.

scp usage is similar to cp in that it copies from a <source> to a <destination>, but uses remote machine addressing to qualify either the <source> or the <destination> but not both. Remote machine addressing looks like this: <user_account>@<host><hostname>:<source_or_destination>

Examples: 

Open a new Terminal (Mac) or Command Prompt (Window) window on your local computer (not logged in to your student account), and try the following, using your studentNN account and GSAF pod host:host.  Note that you will always be prompted for your credentials on the remote host when you execute an scp command.

Code Block
languagebash
titlescp a single file
# On your local computer - not gsafcomp01 or gsafcomp02

# copy "haiku.txt" from your remote student Home directory to your current local directory
scp student01@gsafcomp01.ccbb.utexas.edu:~/haiku.txt . 

# copy "haiku.txt", now in your local current directory, to your remote student 
# Home directory with the name "haiku2.txt"
scp ./haiku.txt student01@gsafcomp01.ccbb.utexas.edu:~/haiku2.txt

...

Code Block
languagebash
titlescp a directory
# On your local computer - not gsafcomp01 or gsafcomp02

# copy the "docs" directory and its contents from your remote student Home directory 
# to a local sub-directory called "local_docs"
scp -r student26@gsafcomp02student01@gsafcomp01.ccbb.utexas.edu:~/docs/ ./local_docs/

# copy the "haiku.txt", nowlocal_docs" sub-directory in your local current directory, to your 
#  remote student 
# Home directory with the name "haiku2.txtremote_docs"
scp -r ./haiku.txt student26@gsafcomp02local_docs/ student01@gsafcomp01.ccbb.utexas.edu:~/haiku2.txt

rsync

...

/remote_docs/

wget (web get)

The wget <url> command lets you retrieve the contents of a valid Internet URL (e.g. http, https, ftp).

  • By default the downloaded file will be stored in the directory where you execute wget
    • with a filename based on the last component of the URL
  • The -O <path> option specifies the file or pathname where the URL data should be written.

Example:

Code Block
# Make a new "wget" directory in your student Home directory and change into it
mkdir ~/wget; cd ~/wget

# download a Gencode statistics file using default output file naming
wget "https://ftp.ebi.ac.uk/pub/databases/gencode/_README_stats.txt"
wc -l _README_stats.txt

# if you execute the same wget again, and the output file already exists
# wget will create a new one with a numeric extension
wget "https://ftp.ebi.ac.uk/pub/databases/gencode/_README_stats.txt"
wc -l _README_stats.txt.1

# download the same Gencode statistics file to a different local filename
wget -O gencode_stats.txt "https://ftp.ebi.ac.uk/pub/databases/gencode/_README_stats.txt"
wc -l gencode_stats.txt


The find command

TBD

...