Skip to content

Instantly share code, notes, and snippets.

@wh13371
Last active August 29, 2015 14:14
Show Gist options
  • Save wh13371/734813a2518f229753dc to your computer and use it in GitHub Desktop.
Save wh13371/734813a2518f229753dc to your computer and use it in GitHub Desktop.
bashrc - linux snippets thereof...
# a decent bash prompt
# \d = date - \t = time - \u = user - \h = host - \w = cwd
PS1='\[\e[1;32m\][\[\e[1;33m\]\d \[\e[1;34m\]\t \[\e[1;32m\]\u\[\e[1;36m\]@\[\e[1;31m\]\h\[\e[1;33m\](\[\e[1;36m\]\w\[\e[1;33m\])\[\e[1;32m\]]\[\e[1;37m\]% \e[m'
# disk usage
alias diskspace="du -Sh | sort -n -r |more"
# move up directories (i.e. "up" or "up 3")
up(){
local d=""
limit=$1
for ((i=1 ; i <= limit ; i++))
do
d=$d/..
done
d=$(echo $d | sed 's/^\///')
if [ -z "$d" ]; then
d=..
fi
cd $d
}
# yyyy/mm/dd/hh/mm/ss/ffffff
alias now='date "+%Y_%m_%d_%H_%M_%S.%6N"'
# look busy
alias busy='cat /dev/urandom | hexdump -C | grep "ca fe"'
# empty trash
alias droptrash="rm -fr ~/.Trash"
# create DIR then CD into it...
function mkcdr {
mkdir -p -v $1
cd $1
}
# Alias chmod commands
alias mx='chmod a+x'
alias 000='chmod 000'
alias 644='chmod 644'
alias 755='chmod 755'
# exit bash session
alias x='exit'
# make cp and mv interactive and verbose given I'm a Linux novice...
alias cp='cp -iv'
alias mv='mv -iv'
# python virtualenv activate\deactivate
alias va='source bin/activate'
alias vd='deactivate'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment