dotfiles/.bashrc

101 lines
2.2 KiB
Bash
Raw Normal View History

2014-01-03 08:00:45 -08:00
# Prompt
PS1="\n[ \w ]--[\$(ls -1 | wc -l | sed 's: ::g') files]\n\h\$ "
2013-09-30 11:20:52 -07:00
# Navigation
if [[ ! "$OSTYPE" == darwin* ]];
then
alias ls="ls --color=auto"
fi
alias c="clear"
2014-02-10 08:23:01 -08:00
alias ..="cd ..;"
2013-09-30 11:20:52 -07:00
alias la="ls -lha"
alias rmr="rm -r"
2014-02-10 08:23:01 -08:00
alias please="sudo !!"
2013-09-30 11:20:52 -07:00
# Applications
alias tmux="tmux -2"
2014-01-07 08:38:34 -08:00
alias grep="grep --color=auto"
2013-09-30 11:20:52 -07:00
# Adding applications to path
if [[ -d ${HOME}/bin ]];
then
export PATH=$PATH:${HOME}/bin
fi
if [[ -d ${HOME}/.rvm ]];
then
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
fi
2013-09-30 11:20:52 -07:00
# Maven
source ~/bin/maven-illuminate.sh
alias mvnc="mvn-c clean"
alias mvnp="mvn-c clean package"
alias mvni="mvn-c clean install"
alias mvna="mvn-c clean assembly:assembly"
alias mvnd="mvn-c clean dependency:copy-dependencies"
2013-09-30 11:20:52 -07:00
# Tar
alias tar-gz="tar xzvf"
alias tar-bz="tar xjvf"
alias tar-xz="tar Jxvf"
# Computer information & control
alias df="df -h"
alias reboot="echo That would be bad..."
alias shutdown="echo Don't do that"
# Ruby
if [[ -f ~/.rvm/scripts/rvm ]];
then
source ~/.rvm/scripts/rvm
fi
2013-09-30 11:20:52 -07:00
# Functions
# (f)ind by (n)ame
# usage: fn foo
# to find all files containing 'foo' in the name
function fn() {
if [ $# -eq 2 ]; then
sudo find $1 -name $2
elif [ $# -eq 1 ]; then
find `pwd` -name $1
else
echo "(f)ind by (n)ame"
echo "usage: fn [name]"
echo "Where name is the file name to search for"
2013-09-30 11:20:52 -07:00
fi
}
2014-01-03 08:00:45 -08:00
# (f)ind by (b)ody
# usage: fb foo
# to find all files containing 'foo' in the body.
#
# usage: fb foo txt
# to find all files ending in '.txt' containing 'foo' in the body.
function fb() {
if [ $# -eq 2 ]; then
grep -r --include="*.$2" $1
elif [ $# -eq 1 ]; then
grep -r "$1"
else
echo "(f)ind by (b)ody"
echo "usage: fb [query] [extension]"
echo "Where query is the string to search for and extension is optional restriction on what files to search"
fi
}
# Backup and Move TiddlyWiki Download
# usage: wiki-move
function wiki-move() {
if [[ -f ${HOME}/Dropbox/wiki.htm ]] && [[ -f ${HOME}/Downloads/wiki.htm ]];
then
echo "Backing up existing wiki and moving new one."
mv ${HOME}/Dropbox/wiki.htm ${HOME}/Dropbox/wiki.htm.old
mv ${HOME}/Downloads/wiki.htm ${HOME}/Dropbox/wiki.htm
echo "Successfully replaced"
fi
}