Skip to content

Instantly share code, notes, and snippets.

@elvinio
Last active May 31, 2016 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elvinio/d9f135c2d339f9ca2fafc57701d573e4 to your computer and use it in GitHub Desktop.
Save elvinio/d9f135c2d339f9ca2fafc57701d573e4 to your computer and use it in GitHub Desktop.
Bashrc
PS1='\t $PWD$ '
################## Start of alias and function helpers #####################
# Change to directory and list content
c (){
if [ $# -eq 1 ]; then
cd $1; ls -ltr;
else
cd ..; ls -ltr;
fi
}
alias c-='cd -; l'
alias c2='cd ../..; l'
alias c3='cd ../../..; l'
alias c4='cd ../../../..; l'
alias c5='cd ../../../../..; l'
alias d='du -sh *'
# find recursively into the directory
# If 2 args, then dir and file
# If 1 arg, then file in current directory
f(){
if [ $# -eq 2 ]; then
find $1 -name "*$2*"
else
find . -name "*$1*"
fi
}
# Search through all files with this term
g (){
grep -r $1 *
}
alias l='ls -ltr'
alias la='ls -ltra'
alias m='make clean; make'
# netstat grepping for this term
n () {
if [ $# -eq 1 ]; then
netstat -anp | grep $1
else
netstat -anp
fi
}
# list current processes with this name
p () {
if [ $# -eq 1 ]; then
ps -ef | grep $1
else
ps -ef
fi
}
alias resource='source ~/.bashrc'
alias s='/home/echua/bin/bin/screen'
# tar target
t(){
tar zcvf $1.tgz $1
}
# untar target
u(){
if [[ $1 == *".zip" ]]; then
unzip $1
else
tar xvf $1
fi
}
alias vi='vim -X'
alias v='vim -X'
#alias vim='/home/echua/bin/bin/vim -X'
# allows super jump with command z
. ~/.vim/z.sh
################## End of alias and function helpers #####################
export PATH=/sbin:/usr/sbin:/bin:/usr/bin
# Set the screen title
case $TERM in
screen*)
# This is the escape sequence ESC k ESC \
SCREENTITLE='\[\ek\w\e\\\]'
;;
*)
SCREENTITLE=''
;;
esac
PS1="${SCREENTITLE}${PS1}"
export TERM=xterm-256color
# don't ask for ssh pass graphically
unset SSH_ASKPASS
# set intel icc license
source /dat/intel-11.1/bin/iccvars.sh intel64
# show uptime upon logon
uptime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment