Versions Compared

Key

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

Table of Contents

...

...

ssh is an executable program that runs on your local computer and allows you to connect securely to a remote computer. We're going to use ssh to access the Lonestar5 Stampede2 compute cluster at TACC, where the remote host name is ls55stampede2.tacc.utexas.edu.

On Macs or Linux, you run ssh from a Terminal window. To invoke a Linux Terminal window if you have the Windows subsystem for Linux installed, double-click on the icon for the Linux distribution you installed (e.g. Ubuntu).

...

  • Double-click the Putty icon
  • In the PuTTY Configuration window
    • make sure the Connection type is SSH
    • enter ls5stampede2.tacc.utexas.edu for Host Name
      • Optional: to save this configuration for further use:
        • Enter stampede2 into the Saved Sessions text box, then click Save
        • Next time select the stampede2 from the Saved Sessions list and click Load.
    • click Open button
    • answer Yes to the SSH security question
  • In the PuTTY terminal
    • enter your TACC user id after the "login as:" prompt, then Enter
    • enter the password associated with your TACC account
    • wait for provide your 2-factor authentication code to arrive via SMS or app, then type it in

The bash shell

You're now at a command line! It looks as if you're running directly on the remote computer, but really there are two programs communicating:

...

Code Block
languagebash
titleCreate symbolic directory links
cd 
ln -s -f $SCRATCH scratch
ln -s -f $WORK$WORK2 workwork2
ln -s -f /workwork2/projects/BioITeam
Tip

$WORK $WORK2 and $SCRATCH are TACC environment variables that refer to your work Work2 and scratch Scratch file system areas. To see the value of an environment variable, use the echo command:

Code Block
languagebash
echo $SCRATCH
Expand
titleWhat is "ln -s" doing?

The ln -s command creates a symbolic link, a shortcut to the linked file or directory.

  • Here the link targets are your work Work2 and scratch Scratch file system areas
  • Having these link shortcuts will help when you want to copy files to your work Work2 or scratch Scratch, and when you navigate the TACC file system using a remote SFTP client
  • Always change directory (cd) to the directory where we want the links created before executing ln -s
    • Here we want the links under your home directory (cd with no arguments)

Want to know where a link points to? Use ls with the -l (long listing) option.

Code Block
languagebash
titlels -l shows where links go
ls -l

...

Code Block
languagebash
titleSet up $HOME/local/bin directory
mkdir -p ~/local/bin
cd ~/local/bin
ln -s -f /workwork2/projects/BioITeam/common/bin/launcher_creator.py
ln -s -f /workwork2/projects/BioITeam/ls5common/opt/samstat-1.09/samstatbin/launcher_maker.py
Tip
titleThe tilde ( ~ ) character

The tilde character ( ~ ) is a pathname shortcut that means "home directory". We'll see more of it later.

$HOME is an environment variable set by TACC that also refers to your home directory.

...

Code Block
languagebash
titleCopy a pre-configured login script
cd
cp /workwork2/projects/BioITeam/projects/courses/Core_NGS_Tools/tacc/bashrc.corengs.ls5stampede2  .bashrc
chmod 600 .bashrc

...

Since .bashrc is executed when you login, to ensure it is set up properly you should first log off ls5 stampede2 like this:

Code Block
languagebash
titleLog off Lonestar5
exit

Then log back in to ls5stampede2.tacc.utexas.edu. This time your .bashrc will be executed and you should see a new shell prompt:

Code Block
ls5stamp2:~$

The great thing about this prompt is that it always tells you where you are, which avoids having to issue the pwd (present working directory) command all the time. Execute these commands to see how the prompt reflects your current directory.

Code Block
languagebash
mkdir -p ~/tmp/a/b/c
cd ~/tmp/a/b/c

# Your prompt should look like this:
ls5stamp2:~/tmp/a/b/c$ 

The prompt now tells you you are in the c sub-directory of the b sub-directory of the a sub-directory of the tmp sub-directory of your home Home directory ( ~ ).

So why don't you see the .bashrc file you copied to your home directory? Because all files starting with a period (dot files) are hidden by default. To see them add the -a (all) option to ls:

...

Code Block
titleLong listing form of ls
ls -la

Details about your login script

...

Tip
titlell alias

Your new ~/.bashrc files defines a ll alias command, so when you type ll it is short for ls -la.

Details about your login script

We list the contents of your .bashrc login script to the Terminal with the cat (concatenate files) command. cat simply reads a file and writes each line of content to standard output (here, your Terminal):

...

Tip
titleDon't use cat for large files
The cat command just echos displays the entire file's content, line by line, without pausing, so should not be used to display large files. Instead, use a pager (like more or less) or look at parts of the file with head or tail.

...

Code Block
languagebash
titleContents of your .bashrc file
#!/bin/bash
# TACC startup script: ~/.bashrc version 2.1 -- 12/17/2013
#   This file is NOT automatically sourced for login shells.
# Your ~/.profile can and should "source" this file.
# Note neither ~/.profile nor ~/.bashrc are sourced automatically by
# by bash scripts. #However, a script Ininherits athe parallelenvironment mpivariables
job,# thisfrom file (its parent shell. Both of these are standard bash behavior.
#   In a parallel mpi job, this file (~/.bashrc) is sourced on every
# node so it is important that actions here not tax the file system.
# Each nodes' environment during an MPI job has ENVIRONMENT set to
# "BATCH" and the prompt variable PS1 empty.
#################################################################
# Optional Startup Script tracking. Normally DBG_ECHO does nothing
if [ -n "$SHELL_STARTUP_DEBUG" ]; then DBG_ECHO "${DBG_INDENT}~/.bashrc{"; fi
######################
# SECTION 1 -- modules
if# [There -z "$__BASHRC_SOURCED__" -a "are 3 independent, safe ways to modify the standard module setup:
#   1) Use "module save"  (see "module help" for details).
#   2) Place module commands in ~/.modules
#   3) Place module commands in this file inside the if block below.
if [ -z "$__BASHRC_SOURCED__" -a "$ENVIRONMENT" != BATCH ]; then
  export __BASHRC_SOURCED__=1
  module load launcher
  module load git
fi
############
# SECTION 2 -- environment variables
if [ -z "$__PERSONAL_PATH__" ]; then
  export __PERSONAL_PATH__=1
fi
# for CCBB summer school courses; then
  export __PERSONAL_PATH__=1
  # for NGS course
  export LANG="C"  # avoid the annoying Perl warnings on cds, etc.
  export PATH=.:$HOME/local/bin:$PATH
  export ALLOCATION=UT-2015-05-18    # Group is G-816696
  export BIWORK=/workwork2/projects/BioITeam
  export CORENGS=$BIWORK/projects/courses/Core_NGS_Tools
  export BI=/corral-repl/utexas/BioITeam

export LS_OPTIONS='-N --color=auto -T 0'/BioITeam
  export PATH=.:$HOME/local/bin:$PATH
# For better colors using a dark background terminal, un-comment this line:
#  #exportexport LS_COLORS=$LS_COLORS:'di=1;33:fi=01:ln=01;36:'
# For better colors using a white background terminal, un-comment this line:
# #export export LS_COLORS=$LS_COLORS:'di=1;34:fi=01:ln=01;36:'
fi
##################################
# SECTION 3 -- controlling the prompt
if [ -n "$PS1" ]; then
  PS1='ls5stamp2:\w$ '; fi
##################################
# SECTION 4 -- Umaskaliases and aliases
umask 002
alias ls="ls --color=always" umask
alias ll="'ls -la"'
alias lahlh="'ls -lah"
alias hexdump='od -A x -t x1z -v'
##########
lh'
umask 002
###################################
# Optional Startup Script tracking
if [ -n "$SHELL_STARTUP_DEBUG" ]; then DBG_ECHO "${DBG_INDENT}}"; fi

...

The login script also sets an environment variable $BIWORK to point to the shared directory /workwork2/projects/BioITeam, and another environment variable $CORENGS to point to the specific sub-directory for our class.

Code Block
languagebash
titleSetting environment variables to useful locations
export BIWORK=/workwork2/projects/BioITeam
export CORENGS=$BIWORK/projects/courses/Core_NGS_Tools

...

You can use these environment variables to shorten typing, for example, to look at the contents of the shared /workwork2/projects/BioITeam directory as shown below, using the magic Tab key to perform shell completion.

...

Code Block
languagebash
titleShell completion exercise
# hit Tab once after typing $BIWORK/ to expand the environment variable
ls $BIWORK/

# now hit Tab twice to see the contents of the directory
ls /workwork2/projects/BioITeam/

# type "pr" and hit Tab again
ls /workwork2/projects/BioITeam/pr

# type "co" and hit Tab again
ls /workwork2/projects/BioITeam/projects/co

# type "Co" and hit Tab again
ls /workwork2/projects/BioITeam/projects/courses/Co

# your command line should now look like this
ls /workwork2/projects/BioITeam/projects/courses/Core_NGS_Tools/

# now type "mi" and one Tab
ls /workwork2/projects/BioITeam/projects/courses/Core_NGS_Tools/mi

# your command line should now look like this
ls /workwork2/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/

# now hit Tab once
# the shell expands as far as it can unambiguously,
# so your command line should look like this
ls /workwork2/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/small

# now hit Tab twice
# You should see 3 filenames, all starting with "small"

# type a period (".") then hit Tab twice again
# You're narrowing down the choices -- you should see two filenames
ls /workwork2/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/small

# finally, type "f" then hit Tab again. It should complete to this:
ls /workwork2/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/small.fq

...

Code Block
languagebash
titleSetting up the friendly shell prompt for stampede
##########
# SECTION 3 -- controlling the prompt
# for NGS course
if [ -n "$PS1" ]; then
  PS1='ls5:\w$ '; fi