# ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples # If not running interactively, don't do anything [ -z "$PS1" ] && return # don't put duplicate lines in the history. See bash(1) for more options export HISTCONTROL=ignoredups # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)" # set variable identifying the chroot you work in (used in the prompt below) if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } parse_svn_branch() { # parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk '{print " (svn::"$1")" }' parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | egrep -o '(tags|branches)/[^/]+|trunk' | egrep -o '[^/]+$' | awk '{print " ("$1")" }' } parse_svn_url() { svn info 2>/dev/null | sed -ne 's#^URL: ##p' } parse_svn_repository_root() { svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p' } SCM_INFO="" if [ -f "/usr/bin/svn" ]; then SCM_INFO="$SCM_INFO\$(parse_svn_branch)" fi if [ -f "/usr/bin/git" ]; then SCM_INFO="$SCM_INFO\$(parse_git_branch)" fi CLEAR="\[\033[00m\]" RED="\[\033[01;31m\]" GREEN="\[\033[01;32m\]" BLUE="\[\033[01;34m\]" YELLOW="\[\033[01;33m\]" PS1="${debian_chroot:+($debian_chroot)}$RED\u@\h$CLEAR:$BLUE\w$YELLOW$SCM_INFO$CLEAR\$ " if [ "$USER" != "root" ]; then PS1="${debian_chroot:+($debian_chroot)}$GREEN\u@\h$CLEAR:$BLUE\w$YELLOW$SCM_INFO$CLEAR\$ " fi # If this is an xterm set the title to user@host:dir case "$TERM" in xterm*|rxvt*) PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"' ;; *) ;; esac # enable color support of ls and also add handy aliases if [ "$TERM" != "dumb" ]; then eval "`dircolors -b`" alias ls='ls --color=auto' #alias dir='ls --color=auto --format=vertical' #alias vdir='ls --color=auto --format=long' fi # some more ls aliases #alias ll='ls -l' #alias la='ls -A' #alias l='ls -CF' # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi # ~/.bashrc: executed by bash(1) for non-login shells. export LC_ALL="C" umask 022 export LS_OPTIONS='--color=auto' eval "`dircolors`" alias ls='ls $LS_OPTIONS' alias ll='ls $LS_OPTIONS -l' alias l='ls $LS_OPTIONS -lA' alias grep='grep --color=auto' export HISTFILESIZE=3000 # the bash history should save 3000 commands alias hist='history | grep $1' #Requires one input alias ps='ps auxf' alias pg='ps aux |grep -v grep |grep' #requires an argument alias un='tar -zxvf' alias openports='netstat -nape --inet' alias ns='netstat -alnp --protocol=inet | grep -v CLOSE_WAIT | cut -c-6,21-94 | tail +2' alias da='date "+%Y-%m-%d %A %T %Z"' alias tl='tail -n 100 -f /var/log/syslog' alias la='ls -Al' alias ls='ls --color=always' alias lx='ls -lXB' # sort by extension alias lk='ls -lSr' # sort by size alias lc='ls -lcr' # sort by change time alias lu='ls -lur' # sort by access time alias lt='ls -ltr' # sort by date alias lm='ls -al |more' # pipe through 'more' alias mx='chmod a+x' alias root='sudo su - root' alias chme='chown $USER:$USER' alias updatebashrc='wget http://www.shane.net.nz/bashrc -O ~/.bashrc' alias myip='wget www.shane.net.nz/ip.php -O- -q' alias valgrind='valgrind --leak-check=full --show-reachable=yes' export MAVEN_OPTS="-Dfile.encoding=ISO-8859-1" export PATH="$PATH:~/bin"