Create a gist now

Instantly share code, notes, and snippets.

@bxt /.bashrc
Last active Nov 2, 2016

What would you like to do?
some stuff for .bashrc
# .bashrc commands by bxt
# color promt:
PS1="\@ \[\033[0;35m\]\u@\\h\[\033[0m\]:\w> "
# ha ha
alias gn8="exit"
# check network config
alias myip="/sbin/ifconfig"
# process-finder
alias psf='ps aux | grep -v grep | grep '
# calculator
? () { echo "$*" | bc -l; }
# avoid duplicate entries in history
export HISTCONTROL=ignoredups
# save history for multiple terminals
shopt -s histappend
# make history long
export HISTSIZE=1000000 HISTFILESIZE=1000000
# ignore exit commands
declare -x HISTIGNORE=exit:gn8
# Share pwd via http on port 8000
webshare () { python -m SimpleHTTPServer $([ -z "$1" ] && echo 8000 || echo $1); }
# set my fav editor
export EDITOR=vim
# colored grep rulz
export GREP_OPTIONS='--color=auto'
# german greetings
if [ `date +%H` -lt 12 ]; then
echo "Moin. "
else
echo "Tach. "
fi
# remember DOS? ;)
alias dir='ls -la'
# list size of all files and dirs and sort
# very useful if you want to know wherer all your TB are gone...
alias imbadu="du -sk ./* | sort -n | awk 'BEGIN{ pref[1]=\"K\"; pref[2]=\"M\"; pref[3]=\"G\";} { total = total + \$1; x = \$1; y = 1; while( x > 1024 ) { x = (x + 1023)/1024; y++; } printf(\"%g%s\t%s\n\",int(x*10)/10,pref[y],\$2); } END { y = 1; while( total > 1024 ) { total = (total + 1023)/1024; y++; } printf(\"Total: %g%s\n\",int(total*10)/10,pref[y]); }'"
# Cool History Summerizer
historyawk(){ history|awk '{a[$2]++}END{for(i in a){printf"%5d\t%s\n",a[i],i}}'|sort -nr|head; }
## https://gist.github.com/87359
# handy find/grep aliases
rgrep() { fgrep -niIR "${1}" .; }
finame() { find . -iname "*${1}*"; }
# produce noise:
alias noise="cat /usr/share/icons/*/* > /dev/dsp"
## http://techfreaks4u.com/blog/posts/geekist-things-i-ever-did-in-linux/
# coin sound:
alias coin='play -q http://store.ukd1.co.uk.s3.amazonaws.com/coin.wav'
## https://gist.github.com/769923
# neat git log:
alias gitlog='git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
## http://gitimmersion.com/lab_10.html
# Create a new minor semver git tag
alias grel='git diff --name-only `git describe --tags --abbrev=0` HEAD && git tag `git describe --tags --abbrev=0 | awk '\''BEGIN {FS="."} {print $1 "." $2 "." ($3+1)}'\''` -m "autotag"'
# quickly create file backups
bu() { cp -v "$1" "$1".`date +%Y-%m-%d.%H-%M-%S`; }
# bundler
alias be='bundle exec'
Owner

bxt commented Apr 15, 2014

Note: cd2 is another cool tool I created for bash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment