Versions Compared

Key

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

Table of Contents

...

...

Code Block
languagebash
titleSSH to access lonestar5 Lonestar6 at TACC
ssh <your_TACC_userID>@ls6.tacc.utexas.edu

...

$WORK2 and $SCRATCH are TACC environment variables that refer to your Work2
Code Block
languagebash
titleCreate symbolic directory links
cd  # ln -s -f $SCRATCH scratchmakes your Home directory the "current directory"
ln -s -f $WORK2$SCRATCH work2scratch
ln -s -f /work2/projects/BioITeam $WORK work
ln -s -f /work2work/projects/BioITeam/projects/courses/Core_NGS_Tools CoreNGS
Tip

Symbolic links (a.k.a. symlinks) are "pointers" to files or directories elsewhere in the file system hierarchy. You can almost always treat a symlink as if it is the actual file or directory.

Tip

$WORK and $SCRATCH are TACC environment variables that refer to your Work and Scratch file system areas. To see the value of an environment variable, use the echo commandThey are like variables in other programming languages, in that they have a name (WORK, SCRATCH) and hold a value ($WORK, $SCRATCH) 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 Work2 Work and Scratch file system areas
  • Having these link shortcuts will help when you want to copy files to your Work2 Work or 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 /work2work/projects/BioITeam/common/bin/launcher_creator.py
ln -s -f /work2work/projects/BioITeam/common/binscript/launcher_maker.py


Tip
titleThe tilde ( ~ ) character

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

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

Setup your login profile (~/.bashrc)

...

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

...

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

Code Block
languagebash
titleLog off Lonestar5Lonestar6
exit

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

Code Block
stamp2ls6:~$

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:
stamp2ls6:~/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 directory ( ~ ).

...

Code Block
titleLong listing form of ls
ls -la


Tip
titlell alias

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

...

#!/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 # bash scripts. However, a script inherits the environment variables # from 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 # There 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.
Code Block
languagebash
titleContents of your .bashrc file
.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 bash scripts.
#   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 [ -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
  # 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 PATH=.:$HOME/local/bin:$PATH
fi
# For better colors using a dark background terminal, un-comment this line:
#export 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 LS_COLORS=$LS_COLORS:'di=1;34:fi=01:ln=01;36:'
export BIWORK=/work2work/projects/BioITeam
 
export CORENGS=$BIWORK/projects/courses/Core_NGS_Tools

 export BI=/corral-repl/utexas/BioITeam
  export PATH=.:$HOME/local/bin:$PATH
# For better colors using a dark background terminal, un-comment this line:
#  export 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 LS_COLORS=$LS_COLORS:'di=1;34:fi=01:ln=01;36:'
fi
########################ALLOCATION=OTH21164        # For ls6        Group is G-824651
##export ALLOCATION=UT-2015-05-18 # For stampede2  Group is G-816696

##########
# SECTION 3 -- controlling the prompt
if [ -n "$PS1" ]; then PS1='stamp2ls6:\w$ '; fi
##################################
# SECTION 4 -- Umask and aliases and umask
#alias ls="ls --color=always"
alias ll='"ls -la'"
alias lah="ls -lah"
alias lc="wc -l"
alias lhhexdump='lsod -A x -t x1z -lhv'
umask 002
#############################################
# Optional Startup Script tracking
if [ -n "$SHELL_STARTUP_DEBUG" ]; then DBG_ECHO "${DBG_INDENT}}"; fi

So what does the common this login script do? A lot! Let's look at just a few of them.

...

The first line is the she-bang. Even though the expression is inside a shell comment (denoted by the # character), it tells the shell (bash) what program should execute this file – in this case, bash itself.

...

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

Environment variables are like variables in a programming language like python or perl (in fact bash is a complete programming language). They have a name (like BIWORK above) and a value (the value for BIWORK of $BIWORK is the pathname /work/projects/BioITeam). Read more about environment variables here: More on environment variables.

...

You can use these environment variables to shorten typing, for example, to look at the contents of the shared /work2work/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 /work2work/projects/BioITeam/

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

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

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

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

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

# your command line should now look like this
ls /work2work/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 /work2work/projects/BioITeam/projects/courses/Core_NGS_Tools/misc/small

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

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

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

...