Last active
December 24, 2015 06:09
-
-
Save dbieber/6755531 to your computer and use it in GitHub Desktop.
Use this .bashrc file for an unfamiliar machine.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EDITOR=vim | |
alias edit=$EDITOR | |
alias c="clear;pwd;ls" | |
alias rc=". ~/.bashrc" | |
alias eb="edit ~/.bashrc" | |
alias ..="cd .." | |
alias cd..="cd .." | |
alias ll="ls -al" | |
function k() { | |
# Kills processes that match all the tokens | |
if [ "$1" ]; then | |
ps | greps $@ | awk '{print $1}' | xargs kill; | |
fi | |
} | |
function greps() { | |
# If only one arg, just grep for it | |
# Otherwise grep for first arg and greps for the rest. | |
# Essentially want to grep for AND of all arguments | |
GREPS1="$1"; | |
if [ -z "$2" ]; then | |
grep $GREPS1; | |
else | |
shift; | |
grep $GREPS1 | greps $@; | |
fi | |
} | |
alias gs="git status" | |
function ga() { # git add files with | |
AWKSCRIPT='{print $NF}'; | |
git status | greps $@ | awk "$AWKSCRIPT" | xargs git add; | |
} | |
alias aaaa="ga mod; git commit --amend" # add all and amend | |
alias 4a=aaaa | |
alias a4=4a | |
alias aaac="ga mod; git commit" # add all and commit | |
alias acm="ga mod; git commit -m" # add, commit, message | |
alias gb="git branch" | |
alias gc="git checkout" | |
alias gcm="git commit -m" | |
alias gd="git diff" | |
alias gdh="git diff HEAD" | |
alias gd^="git diff HEAD^" | |
alias gh="history | grep" | |
alias gl="git log" | |
alias gg="git grep" | |
alias ggn="git grep -n" | |
alias clean="rm *~; rm .*~" | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxCxDxBxegedabagacad | |
# Prompt and prompt colors | |
# 30m - Black | |
# 31m - Red | |
# 32m - Green | |
# 33m - Yellow | |
# 34m - Blue | |
# 35m - Purple | |
# 36m - Cyan | |
# 37m - White | |
# 0 - Normal | |
# 1 - Bold | |
function prompt { | |
local BLACK="\[\033[0;30m\]" | |
local BLACKBOLD="\[\033[1;30m\]" | |
local RED="\[\033[0;31m\]" | |
local REDBOLD="\[\033[1;31m\]" | |
local GREEN="\[\033[0;32m\]" | |
local GREENBOLD="\[\033[1;32m\]" | |
local YELLOW="\[\033[0;33m\]" | |
local YELLOWBOLD="\[\033[1;33m\]" | |
local BLUE="\[\033[0;34m\]" | |
local BLUEBOLD="\[\033[1;34m\]" | |
local PURPLE="\[\033[0;35m\]" | |
local PURPLEBOLD="\[\033[1;35m\]" | |
local CYAN="\[\033[0;36m\]" | |
local CYANBOLD="\[\033[1;36m\]" | |
local WHITE="\[\033[0;37m\]" | |
local WHITEBOLD="\[\033[1;37m\]" | |
export PS1="$YELLOWBOLD[\$(date +%k:%M:%S)] \w> $WHITE" | |
} | |
prompt | |
pwd | |
ls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment