Bash and HCC

some of my little tips

.bash_profile, .bash_alias, .bashrc

  • .bash_alias:
# Linux aliases
alias mybin='ll ~/bin/mypackbin/'
alias md='module load irods; module load R; module load python'
alias ftoday='find -maxdepth 1 -type f -mtime -1' # Find today's file
alias R='module load R; R'
#alias load='source ~/.bash_profile'

# some aliases
alias ac='less ~/.ssh/config | grep Host'
alias al='view ~/.bash_aliases'
alias du1='du -h --max-depth=1 .'

# -----------------------
# HPC system alias
# ----------------------
alias ll='ls -lF -h'
alias mysq='squeue --format="%.18i %.9A %.9P %.8j %.8u %.2t %.10M %.6D %R %.9m"'
alias srun1='srun --nodes=1 --mem 1024 --ntasks=1 --licenses=common --time=8:00:00 --pty bash'
alias srun4='srun --nodes=1 --mem 4G --ntasks=4 --licenses=common --time=8:00:00 --pty bash'
alias srunq4='srun --qos=short --nodes=1 --licenses=common --ntasks=4 --mem 32G --time 6:00:00 --pty bash'
alias srunq1="srun --qos=short --nodes=1 --licenses=common --ntasks-per-node=1 --mem-per-cpu=1024 --time 6:00:00 --pty $SHELL"
alias myjob='mysq | grep jyang21'
alias mylab='mysq | egrep "jyang21|raghu|xie186"'
# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias squeue='squeue --format="%.12i %.0P %.18j %.8u %.2t %.10M %.6D %R %C"'

#   -----------------------------
#   -----------------------------

alias tar='tar -zxvf'
alias cp='cp -iv'                           # Preferred 'cp' implementation
alias mv='mv -iv'                           # Preferred 'mv' implementation
alias mkdir='mkdir -pv'                     # Preferred 'mkdir' implementation
alias ll='ls -FGlAhp'                       # Preferred 'ls' implementation
#alias less='less -FSRXc'                    # Preferred 'less' implementation
cd() { builtin cd "$@"; ll; }               # Always list directory contents upon 'cd'
alias cd..='cd ../'                         # Go back 1 directory level (for fast typers)
alias ..='cd ../'                           # Go back 1 directory level


export MARKPATH=$HOME/.marks
function jump {
    cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
function mark {
    mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$1"
function unmark {
    rm -i "$MARKPATH/$1"
function marks {
    ls -l "$MARKPATH" | sed 's/  / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo

_completemarks() {
  local curw=${COMP_WORDS[COMP_CWORD]}
  local wordlist=$(find $MARKPATH -type l -printf "%f\n")
  COMPREPLY=($(compgen -W '${wordlist[@]}' -- "$curw"))
  return 0

complete -F _completemarks jump unmark

About HCC

  • head node and compute node
  • file systems: /home, /work, and common


An example project:

Mineral GWAS

git clone

Path normalization:

knitr::opts_chunk$set(echo = TRUE) 

License: GPL v3

GWAS on Mineral Composition

Includes data analysis from 2009 and 2010, 2 technical reps per sample. Got the phenotypic data from Datasets from 2009 and 2010 were combined for further analysis (BLUP estimation, heritability and GWAS)


This is an ongoing research project. It was intended for internal lab usage. It has not been extensively tested. Use at your own risk. It is a free and open source software, licensed under GPLv3.