#------------------------------------------------------------------------------ # File: $HOME/.bashrc # Author: Uwe Hermann # URL: http://www.hermann-uwe.de/files/bashrc # $Id: .bashrc 551 2006-08-26 11:12:28Z uh1763 $ #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Returncode. #------------------------------------------------------------------------------ function returncode { returncode=$? if [ $returncode != 0 ]; then echo "[$returncode]" else echo "" fi } #------------------------------------------------------------------------------ # Path. #------------------------------------------------------------------------------ PATH="/usr/bin:/bin:/usr/bin/X11:/usr/sbin:/sbin:/usr/games" PATH="$PATH:/usr/local/bin:/usr/local/sbin" export PATH #------------------------------------------------------------------------------ # Prompt. #------------------------------------------------------------------------------ if [ "$BASH" ]; then if [ "`id -u`" -eq 0 ]; then # The root prompt is red. PS1='\[\033[0;31m\]\u@\h:\w >\[\033[0;37m\] ' else # PS1='\u@\h:\w > ' PS1='\[\033[0;31m\]$(returncode)\[\033[0;37m\]\[\033[0;35m\]\u@\h\[\033[0;37m\]:\[\033[0;36m\]\w\[\033[0;37m\] > ' fi else if [ "`id -u`" -eq 0 ]; then PS1='# ' else PS1='$ ' fi fi export PS1 # Whenever displaying the prompt, write the previous line to .bash_history. PROMPT_COMMAND='history -a' #------------------------------------------------------------------------------ # Bash options. #------------------------------------------------------------------------------ set -o notify #------------------------------------------------------------------------------ # Bash shopts. #------------------------------------------------------------------------------ shopt -s extglob shopt -s progcomp shopt -s histappend shopt -s histreedit shopt -s histverify shopt -s cmdhist shopt -s lithist # shopt -s cdspell shopt -s no_empty_cmd_completion shopt -s checkhash shopt -s hostcomplete #------------------------------------------------------------------------------ # Completion. #------------------------------------------------------------------------------ complete -A alias alias unalias complete -A command which complete -A export export printenv complete -A hostname ssh telnet ftp ncftp ping dig nmap complete -A helptopic help complete -A job -P '%' fg jobs complete -A setopt set complete -A shopt shopt complete -A signal kill killall complete -A user su userdel passwd complete -A group groupdel groupmod newgrp complete -A directory cd rmdir # If available, source the global bash completion file. # See http://www.caliban.org/bash/index.shtml#completion for details. if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi complete -f -X '!*.@(gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG|xcf|bmp|BMP|pcx|PCX)' gimp complete -f -X '!*.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|vcd|ps|pes|fli|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp3|MP3|ogg|OGG|ogm|OGM|mp4|MP4|wav|WAV|asx|ASX|mng|MNG|m4v)' mplayer #------------------------------------------------------------------------------ # Colorized ls. #------------------------------------------------------------------------------ eval `dircolors` LS_COLORS="$LS_COLORS*.JPG=01;35:*.GIF=01;35:*.jpeg=01;35:*.pcx=01;35:*.png=01;35:*.pnm=01;35:*.bz2=01;31:*.mpg=01;38:*.mpeg=01;38:*.MPG=01;38:*.MPEG=01;38:*.m4v=01;038:*.mp4=01;038:*.swf=01;038:*.avi=01;38:*.AVI=01;38:*.wmv=01;38:*.WMV=01;38:*.asf=01;38:*.ASF=01;38:*.mov=01;38:*.MOV=01;38:*.mp3=01;39:*.ogg=01;39:*.MP3=01;39:*.Mp3=01;39" export LS_OPTIONS='--color=auto' alias ls='ls $LS_OPTIONS' #------------------------------------------------------------------------------ # Security. #------------------------------------------------------------------------------ alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias ln='ln -i' #------------------------------------------------------------------------------ # Typos. #------------------------------------------------------------------------------ alias scsl=clear alias qcls=clear alias clls=clear alias csl=clear alias cll=clear alias slc=clear alias lcs=clear alias lsc=clear alias sls=clear alias scl=clear alias cs=clear alias c=clear alias cl=clear alias ssl=clear alias csll=clear alias clsl=clear alias chmdo=chmod alias sl=ls alias sll=ls alias lsl=ls alias s=ls alias psa='ps a' alias tarx='tar x' alias maek=make alias act=cat alias cart=cat alias grpe=grep alias gpre=grep alias whcih=which alias icfonfig=ifconfig alias ifocnfig=ifconfig alias iv=vi alias lvi=vi alias vf=cd alias vp=cp alias nmv=mv alias mann=man alias nman=man alias nmann=man alias mb=mv alias csv=cvs alias lintina=lintian alias nmplayer=mplayer #------------------------------------------------------------------------------ # Miscellaneous. #------------------------------------------------------------------------------ # mesg n # Disable messages. # setterm -blength 0 # Disable annoying beep. ulimit -c unlimited # No limits. eval `lesspipe` # Allow less to view *.gz etc. files. #------------------------------------------------------------------------------ # Environment Variables. #------------------------------------------------------------------------------ export EDITOR=vim export NNTPSERVER=localhost export HISTSIZE=2000 export HISTFILESIZE=100000 export HISTIGNORE= export MESA_GLX_FX=fullscreen export CVS_RSH=ssh export VIMRUNTIME=/usr/share/vim/vimcurrent export VIM=/usr/share/vim/vimcurrent export PAGER=less export LESS=i #------------------------------------------------------------------------------ # Terminal settings. #------------------------------------------------------------------------------ if ! [ $TERM ] ; then eval `tset -s -Q` case $TERM in con*|vt100|linux|xterm) tset -Q -e ^? ;; esac fi #------------------------------------------------------------------------------ # Useful aliases to save some typing. #------------------------------------------------------------------------------ alias cls='clear' alias l='ls -lA' alias lsr='ls -lSr' alias md='mkdir' alias rd='rmdir' alias cd..='cd ..' alias ..='cd ..' alias ...='cd ../..' alias ddu='find . -maxdepth 1 -type d -exec du -s {} \;' alias mc='LANG=en_US mc -c' alias unix2dos='recode lat1..ibmpc' alias dos2unix='recode ibmpc..lat1' alias mik='mikmod -p 4 -c -t -nohqmixer *' alias m='mp3blaster -p allrandom -R -q *.[mM][pP]3' alias wrec='wavr -s 44100 -d 16 -c 2 -s l -f' alias v='clear; vlock -a -q' alias vv='clear; lockvc stars' alias t='vim -c ":$" ~/.todo' alias todo='cat ~/.todo' alias mplayer='mplayer -really-quiet -ao sdl' alias xine='xine --no-logo --no-splash -g' alias ccc='cvs -z3 diff -Nup | vim -' alias svn='LANG=de_DE svn' alias sss='svn diff | vim -' alias svnst='svn st --no-ignore' alias svnlog='svn log -v' alias svnps='svn ps svn:keywords "Author Date Id Rev URL"' alias ma='make 1>/dev/null' alias p='ping www.heise.de' alias lintian='lintian -i -I' alias linda='linda -i' alias apt-get='apt-get -u' alias more='less' alias gnumeric='LANG=de_DE gnumeric' alias pon='pon dsl-provider' alias cvs2cl='cvs2cl -rbtT' alias n='netstat -a -e -e -p -A inet' alias my='mysql -u root -p' alias ff='find . -type f -exec chmod 644 {} \;' alias fd='find . -type d -exec chmod 755 {} \;' alias checkpo='for i in *.po; do echo -n "$i: " ; msgfmt --statistics $i ; done' alias ru='ruby setup.rb all' alias HEX="ruby -e 'printf(\"0x%X\n\", ARGV[0])'" alias DEC="ruby -e 'printf(\"%d\n\", ARGV[0])'" alias BIN="ruby -e 'printf(\"%bb\n\", ARGV[0])'" alias WORD="ruby -e 'printf(\"0x%04X\n\", ARGV[0])'" #------------------------------------------------------------------------------ # Debian stuff. #------------------------------------------------------------------------------ export DEBEMAIL='uwe@debian.org' export DEBFULLNAME='Uwe Hermann' alias bui='dpkg-buildpackage -sgpg -kUwe -rfakeroot' alias bui2='dpkg-buildpackage -us -uc -rfakeroot' alias sbui='svn-buildpackage -sgpg -kUwe -rfakeroot' alias sbui2='svn-buildpackage -us -uc -rfakeroot' alias reportbug='reportbug -b -M --no-cc --no-check-available' alias fak='fakeroot debian/rules clean' #------------------------------------------------------------------------------ # Anonymize traffic using Tor. See http://tor.eff.org for details. # See also http://wiki.noreply.org/noreply/TheOnionRouter/TorifyHOWTO. #------------------------------------------------------------------------------ # Tor + Privoxy for all applications which honor HTTP_PROXY (lynx, wget, etc.). # export http_proxy=http://127.0.0.1:8118/ # export HTTP_PROXY=http://127.0.0.1:8118/ # Torify fetchmail. # DANGER: This leaks DNS information! Only use IPs (no host/domain names) # in your ~/.fetchmailrc file! # You can resolve host/domain names manually with tor-resolve(1). # DANGER: If you use unencrypted POP3, Tor node admins can sniff passwords! # alias fetchmail='torify fetchmail' #------------------------------------------------------------------------------ # Import local/private settings. #------------------------------------------------------------------------------ if [ -f ~/.bashrc.local ]; then . ~/.bashrc.local fi #------------------------------------------------------------------------------ # User-dependent Settings. #------------------------------------------------------------------------------ if [ "`id -u`" -eq 0 ]; then umask 022 else umask 077 # # Print TODO file. # if test -f ~/.todo; then # cat ~/.todo # fi # # Print fortune cookies. # if [ "`which fortune`" != "" ]; then # echo # fortune # fi fi