# .bashrc # User specific aliases and functions # Source global definitions [ -f /etc/bashrc ] && . /etc/bashrc ####################################### # user specific environment ####################################### # for mc, cvs, svn, ... export EDITOR=nano # vim and gnome-terminal have support for 256 colours in fedora 8 at least # Note debian/ubuntu users should install the ncurses-term package to support this #export TERM=xterm-256color # setup default search path for python modules. # Note we add this to the 'path' in .vimrc so the gf # command will open any .py or .h files etc. in this dir export PYTHONPATH=~/pb.o/libs/ # Setting the path for MacPorts. PATH="/opt/local/bin:/opt/local/sbin:${PATH}" export PATH test -r /sw/bin/init.sh && . /sw/bin/init.sh # Setting PATH for MacPython 2.5 PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}" export PATH ####################################### # change app defaults ####################################### # Don't store duplicate adjacent items in the history HISTCONTROL=ignoreboth # adjust settings according to current terminal window width # which may have changed while the last command was running # (which is a common occurance for vim/less/etc.) # Note this is already set in /etc/bashrc on Fedora 8 at least. shopt -s checkwinsize # GREP_COLOR=bright yellow on black bg. # use GREP_COLOR=7 to highlight whitespace on black terminals # LANG=C for speed. See also: http://www.pixelbeat.org/scripts/findrepo alias grep='GREP_COLOR="1;33;40" LANG=C grep --color=auto' alias ls="BLOCK_SIZE=\'1 ls -G" #enable thousands grouping and colour alias diff='LC_ALL=C TZ=GMT0 diff -Naur' #normalise diffs for distribution alias links='links -force-html' #need to enable colour in config menu manually alias xterm='xterm -fb "" -bg black -fg gray -fa "Sans Mono" -fs 10 +sb -sl 3000 -g 80x50+1+1' alias vim='vim -X' #don't try to contact xserver (which can hang on network issues) # Enable colors for ls, etc. Prefer ~/.dir_colors #64489 if [[ -f ~/.dir_colors ]]; then eval `dircolors -b ~/.dir_colors` elif [[ -f /etc/DIR_COLORS ]]; then eval `dircolors -b /etc/DIR_COLORS` fi # I hate noise set bell-style visible # Tell less not to beep and also display colours export LESS="-QR" # Let me have core dumps ulimit -c unlimited # Highlight LS putput (Borrowed from Gentoo) LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.patch=00;32:*.diff=00;32:*.log=00;32:*.tex=00;32:*.doc=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:' export LS_COLORS ####################################### # shortcut aliases ####################################### #quick dir listing, latest files/dirs at the bottom alias l="ls -lrt" #quick ls -al alias ll="ls -al" #quick ls -alh alias llh="ll -h" #just list directories alias lld='ls -lUd */' #what most people want from od (hexdump) alias hd='od -Ax -tx1' # canonicalize path (including resolving symlinks) alias realpath='readlink -f' # make and change to a directory md () { mkdir -p "$1" && cd "$1"; } ####################################### # change app defaults ####################################### # function to print the sum of all files in the pwd function lsbytesum { local TotalBytes=0 for Bytes in $(/bin/ls -l | grep "^-" | awk '{ print $5 }') do let TotalBytes=$TotalBytes+$Bytes done local TotalMeg=$(echo -e "scale=3 \n$TotalBytes/1048576 \nquit" | bc) echo -n "$TotalMeg" } # Set the titlebar text case $TERM in xterm*|rxvt*|Eterm|aterm|kterm|gnome) TITLEBAR='\[\033]0;\u@\h:\w\007\]' ;; screen) TITLEBAR='\[\033]0;\u@\h:\w\007\]' #TITLEBAR='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"' ;; *) TITLEBAR="" ;; esac # Pretty, colourful prompt(s) #Gentoo Prompt #if [[ ${EUID} == 0 ]] #then # # Root's prompt is RED # PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' #else # # User's prompt is GREEN # PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' #fi #Apple prompt, colorized #PS1='\[\033[01;32m\]\h\[\033[0m\]:\[\033[01;34m\]\W \[\033[01;32m\]\u\[\033[01;34m\]\$\[\033[00m\] ' #Bryce's prompt #PS1=$TITLEBAR'\[\033[01;32m\]\h\[\033[0m\]:\[\033[01;34m\]\W \[\033[01;32m\]\u\[\033[01;34m\]\$\[\033[00m\] ' #Bryce's new prompt # Evaluate the return value after every command, display it boldly for non-zero values PROMPT_COMMAND='RETVAL=$?;if [ "x$RETVAL" = "x0" ]; then RETVAL="" ; else RETVAL=$(echo -en " \033[7;31m$RETVAL\033[00m") ; fi' if [[ ${EUID} == 0 ]] then # Root's prompt is RED PS1=$TITLEBAR'\[\033[00;31m\][\u@\[\033[1;31m\]\h\[\033[00;31m\]]\[\033[00m\] -- \[\033[00;33m\][\d \t]\[\033[00m\] -- \[\033[00;35m\][$(lsbytesum)Mb]\[\033[00m\]\n(\!)$RETVAL\[\033[01;34m\] \w \$\[\033[00m\] ' else # User's prompt is GREEN PS1=$TITLEBAR'\[\033[00;32m\][\u@\[\033[1;32m\]\h\[\033[00;32m\]]\[\033[00m\] -- \[\033[00;33m\][\d \t]\[\033[00m\] -- \[\033[00;35m\][$(lsbytesum)Mb]\[\033[00m\]\n(\!)$RETVAL\[\033[01;34m\] \w \$\[\033[00m\] ' fi