~ inky
/.bashrc
I try to keep this very general so I can use the same .bashrc anywhere. Another file (~/.inkyrc) is used for machine-specific settings.
[ -z "$PS1" ] && return # return if not running interactively
shopt -s checkwinsize # check and update lines & cols after each cmd
shopt -s cmdhist # multiline commands saved in history as oneliners
shopt -s histappend
set -o vi # vi mode -- see http://www.hypexr.org/bash_tutorial.php#vi
export EDITOR=vim
export HISTCONTROL='ignoreboth:erasedups'
export HISTIGNORE='&:l:l[sla]:c[dl]:[bf]g:exit:logout:#'
export HISTSIZE=1000
export LC_ALL=en_IE.UTF-8
export LESSCHARSET=utf-8
export PYTHONPATH=$HOME/lib/python
# terminal title
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}\007"' ;;
*)
;;
esac
# prompt
c1="\[\033[0;40;32m\]" # green on black
c2="\[\033[1;32m\]" # bold green
c_reset="\[\033[0m\]"
export PS1="${c1}\u.\h[${c2}\w${c1}]\$${c_reset} "
# tab completion
[ -e /etc/bash_completion ] && . /etc/bash_completion
# ls colours
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
fi
# shortcuts
alias ..='cd ..'
alias :q='exit' :wq='exit' # really wish I didn't need these
alias d='dict'
alias fo='kill -9' foad='killall -9'
alias l='ls -Fhlv' la='ls -AFv' ll='ls -AFhlv'
alias m='mutt -y'
alias r='screen -DRA && echo'
alias v='vim'
# simple encryption
function blow()
{
[ -z "$1" ] && echo 'Encrypt: blow FILE' && return 1
openssl bf-cbc -salt -in "$1" -out "$1.bf"
}
function fish()
{
test -z "$1" -o -z "$2" && echo \
'Decrypt: fish INFILE OUTFILE' && return 1
openssl bf-cbc -d -salt -in "$1" -out "$2"
}
# processes
function p_cpu()
{
ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu \
| sed '/^ 0.0 /d' | pr -TW$COLUMNS
}
function p_mem()
{
ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS
}
function p_user() { ps aux | grep "^$USER" | pr -TW$COLUMNS; }
alias p='p_user'
# partial download
alias scpr="rsync --modify-window=1 -Phavze 'ssh -xac blowfish-cbc'"
alias nscpr="nice -n15 rsync --modify-window=1 -Phavze 'ssh -xac blowfish-cbc'"
# other useful commands
alias calc='python -ic "from math import *; from random import *"'
# local settings
[ -e $HOME/.inkyrc ] && . $HOME/.inkyrc