Skip to content

My custom bashrc

2008 June 10
tags: ,
by Philippe Delodder

In the years I’m using Debian as Server and as Desktop, I have changed my .bashrc regularly. But since I’m using a few system and trying new enviroments or reinstalling the system. I’m going to put my .bashrc online, for the purpose I might need it in the future or somebody else might need it.

The bashrc contains allias for debian apt and an extract function. The extract lets you easily extract the following types: .tar.bz2, .tar.bz, .tar.gz, .bz2, .rar, .gz, .tar, .zip, .Z
.

Most of the things in this .bashrc are found on the internet and modified to my personal needs.

~/.bashrc

#------------------------------
# COLORS
#------------------------------
NONE="\[\033[0m\]"
BK="\[\033[0;30m\]" #Black
EBK="\[\033[1;30m\]"
RD="\[\033[0;31m\]" #Red
ERD="\[\033[1;31m\]"
GR="\[\033[0;32m\]" #Green
EGR="\[\033[1;32m\]"
YW="\[\033[0;33m\]" #Yellow
EYW="\[\033[1;33m\]"
BL="\[\033[0;34m\]" #Blue
EBL="\[\033[1;34m\]"
MG="\[\033[0;35m\]" #Magenta
EMG="\[\033[1;35m\]"
CY="\[\033[0;36m\]" #Cyan
ECY="\[\033[1;36m\]"
WH="\[\033[0;37m\]" #White
EWH="\[\033[1;37m\]"

# user preferences
unset LESS
export PAGER=less

### power-aliases :
#==> debian package management
alias -- -search="apt-cache search"
alias -- -show="apt-cache show"
alias -- -install="apt-get install"
alias -- -remove="apt-get remove"
alias -- -update="apt-get update"
alias -- -upgrade="apt-get upgrade"
alias -- -source="dpkg -S"
alias -- -list="dpkg -l"
alias -- -files="dpkg -L"
#==> default command options
alias less="less -I -R"
alias grep="grep --color=auto"
alias ls="ls --color=auto"
#==> file removal
alias   pur="rm -v *~"
alias   purge='find . -name "*~" -print -exec rm -f {} \;'

### bash-settings :
#==> history timestamps (bash 3.0), ignoredups, size, etc.
HISTCONTROL=ignoredups
HISTSIZE=20000
HISTFILESIZE=20000
HISTTIMEFORMAT="[%Y-%m-%d - %H:%M:%S] "
shopt -s checkwinsize
shopt -s extglob
shopt -s nocaseglob
shopt -s nullglob dotglob

### self.bash.functions
#===> (self)
if [[ -f ~/.bash_functions ]]; then
source ~/.bash_functions
fi

export EDITOR=nano

export PATH=$PATH:~/bin

export PATH=$PATH:~/scripts

# PROMPT
if [ `id -un` != root ]; then
PS1="[${EGR}\u@\h${EBL} \W${NONE}]# "
else
PS1="[${ERD}\h${EBL} \W${NONE}]# "
fi

# Change the window title of X terminals
case $TERM in
xterm*|rxvt*|Eterm)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\00
7"'
;;
screen)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\
\"'
;;
esac

~/.bash_functions

extract () { if [ -f $1 ] ; then
case $1 in
*.tar.bz2)      tar xjvf $1     ;;
*.tar.bz)       tar xjvf $1     ;;
*.tar.gz)       tar xvzf $1     ;;
*.bz2)          bunzip2 $1      ;;
*.rar)          rar x $1        ;;
*.gz)           gunzip $1       ;;
*.tar)          tar xvf $1      ;;
*.zip)          unzip $1        ;;
*.Z)            uncompress $1   ;;
*)              echo "'$1' cannot be extracted via extra
ct()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}

If you want colored out put of the files you can view here: ~/.bashrc or ~/.bash_functions

2 Responses leave one →
  1. December 2, 2008

    thanks dude ;) i used the decompress section… the rest i allready did for myself :)
    should i post mine too :)

  2. December 2, 2008

    Yea that’s create if you want to post it

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS

Bad Behavior has blocked 116 access attempts in the last 7 days.