bashrc on the farm

August 09 2018 17:19:17.

My .bashrc on the Roma1 farm:



if tty > /dev/null; then
alias cd..='cd ..'
alias ll='ls -ltrh'
alias ls='ls -GF'
export PS1='[\[\033[01;32m\]\u@\h:\[\033[34m\]\w\[\033[0m\]]\$ '
if [[ $HOSTNAME =~ "farm-login-01.roma1.infn.it" || $HOSTNAME =~ "farm-login-02.roma1.infn.it" ]]; then
. /chirone/soft/linuxbrew/set.sh
alias emacs='emacs -nw --user ""'
export PS1='[\[\033[01;32m\]\u@farm:\[\033[34m\]\w\[\033[0m\]]\$ '
export G4DIR=/chirone/soft/geant4.10.04.p02-install
elif [[ $HOSTNAME =~ "leila" || $HOSTNAME =~ "bb8" || $HOSTNAME =~ "hansolo" ]]; then
export FLUPRO=/home/soft/fluka
export FLUKA=$FLUPRO
export FLUFOR=gfortran
export ROOTSYS=/home/soft/root-install_6.08.02
export G4DIR=/home/soft/geant-install_10.03.p02
fi

if [ -z $ROOTSYS ]; then
echo "ROOTSYS is not setted"
else
. $ROOTSYS/bin/thisroot.sh
alias root='root -l'
fi

if [ -z $G4DIR ]; then
echo "G4DIR is not setted"
else
. $G4DIR/bin/geant4.sh
alias g4make='cmake -DGeant4_DIR=$G4INSTALL'
fi

# GNU SCREEN
function myscreendisplay {
echo export DISPLAY=$DISPLAY > ~/.display;
if [ -n "${SESSION_MANAGER+x}" ]; then
echo export SESSION_MANAGER=$SESSION_MANAGER >> ~/.display
else
echo unset SESSION_MANAGER >> ~/.display
fi;
}
alias screen='myscreendisplay; screen -D -R'
alias disp='source ~/.display'

# extract: Extract most know archives with one command
# ---------------------------------------------------------
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}

export HISTCONTROL=ignoredups
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'

function gzless()
{
gzip -cd $1 | less ;
}

alias ttop="top -R -F -s 10 -o rsize"
findPid () { lsof -t -c "$@" ; }

# zipf: To create a ZIP archive of a folder
zipf () { zip -r "$1".zip "$1" ; }

mans () {
man $1 | grep -iC2 --color=always $2 | less
}

# lr: Full Recursive Directory Listing
# ------------------------------------------
alias lr='ls -R | grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\'' | less'

# ii: display useful host related informaton
# -------------------------------------------------------------------
ii() {
echo -e "\nYou are logged on ${RED}$HOST"
echo -e "\nAdditionnal information:$NC " ; uname -a
echo -e "\n${RED}Users logged on:$NC " ; w -h
echo -e "\n${RED}Current date :$NC " ; date
echo -e "\n${RED}Machine stats :$NC " ; uptime
echo -e "\n${RED}Current network location :$NC " ; scselect
echo -e "\n${RED}Public facing IP Address :$NC " ;myip
#echo -e "\n${RED}DNS Configuration:$NC " ; scutil --dns
echo
}

fi #end check if interactive