-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaliases
140 lines (126 loc) · 4.24 KB
/
aliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File Modifications
# ------------------
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# -> Prevents accidentally clobbering files.
# Disk Utility
# ------------
alias du='du -h'
alias df='df -kh'
# The 'ls' family
# ---------------
alias lx='ls -lXB' # sort by extension
alias lk='ls -lSr' # sort by size
alias l='clear; ls -1' # long list
alias la='ls -lA' # show hidden files
alias laf='ls -a | grep "^\."' # hidden files only
alias lad='ls -ad .* | grep / | more -p' # hidden directories only
alias ll="ls -l"
alias lt='ls -ltr' # sort by date
alias lm='ls -al |more' # pipe through 'more'
alias ld="ls -l | egrep '^d'"
alias lf="ls -l | egrep -v '^d'"
# spelling typos
# --------------
alias xs='cd'
alias vf='cd'
alias moer='more'
alias moew='more'
alias kk='ll'
# Other
# -----
alias vi='vim'
alias zshconfig="vim ~/.zshrc"
alias ohmyzsh="vim ~/.oh-my-zsh"
alias refresh='. ~/.zshrc'
alias j='jobs -l'
alias path='echo -e ${PATH//:/\\n}'
alias c='clear; ls -1'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias reload='source ~/bin/dotfiles/bash/aliases'
alias md='mkdir -p'
alias e='exit'
alias kb="kill -9 %1 %2"
alias grep='grep --color=auto' # Color found text
alias cpr='cp -rpv'
alias whatismyip="wget -q -O - http://whatismyip.com/automation/n09230945.asp"
alias pg='ps -ef | grep'
alias ag='alias | grep'
alias lsof='lsof -Pnl +M -i4'
alias lsof6='lsof -Pnl +M -i6'
alias nst='netstat -anf inet'
alias less='less --RAW-CONTROL-CHARS'
alias muz='mux' # To protect against typo
alias tmuz='tmux' # To protect against typo
alias hgrep='history | grep'
alias java6='/usr/libexec/java_home -v 1.6'
alias java7='/usr/libexec/java_home -v 1.7'
# Processes
# ---------
alias tu='top -o cpu' # cpu
alias tm='top -o vsize' # memory
function my_ps() { ps $@ -u $USER -o pid,%cpu,%mem,bsdtime,command ; }
function pp() { my_ps f | awk '!/awk/ && $0~var' var=${1:-".*"} ; }
# Git
# ---
alias ungit="find . -name '.git' -exec rm -rf {} \;"
alias gb='git branch'
alias gc='git commit -vm'
alias gd='git diff --color'
alias gdw='git diff --word-diff=porcelain'
alias gl='git pull'
alias gp='git push'
alias g='git status -sb'
alias gconf='cat .git/config'
alias gk='gitk &'
alias grb='git rebase'
alias grba='git rebase --abort'
alias grbc='git rebase --continue'
alias gfa='git fetch --all'
alias gfarb='gfap && git rebase origin/master'
alias gfm='git fetch origin master'
alias gfmrb='git fetch origin && git rebase origin/master'
alias gcp='git cherry-pick'
alias gss='git stash save'
alias gsp='git stash pop'
alias gsc='git stash clear'
alias gsa='git stash apply'
alias gsl='git stash list'
alias gitreflog='git reflog --date=local'
alias gbdate='for k in `git branch|perl -pe s/^..//`;do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;done|sort -r'
alias gcloneb='git clone -b $1 $2' # Clone a specific branch
alias glog="git log --graph --no-merges --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%an%Creset' --abbrev-commit --date=relative --tags"
# Call from inside an initialized Git repo, with the name of the repo.
function new-git() {
ssh [email protected] "mkdir $1.git && cd $1.git && git --bare init"
git remote add origin [email protected]:$1.git
git push origin master
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git config push.default current
}
# Git undo last commit
alias gitundo='git reset --soft HEAD^'
# Gerrit
# ------
function grc() {
ssh -p 29418 gerrit.rfiserve.net gerrit query status:open owner:Pratik project:$1/$2 $*
}
# Ruby
# ----
alias r="bundle exec rake"
alias sc='bundle exec script/console'
alias ss='bundle exec script/server'
# MySql
# -----
alias mysqlvars='mysqladmin variables' # To see what values a running MySQL server is using
alias mysqldhelp='mysqld --verbose --help'
# File & strings related functions
# --------------------------------
function ff() { find . -name '*'$1'*' ; } # find a file
function fe() { find . -name '*'$1'*' -exec $2 {} \; ; } # find a file and run $2 on it
# Show me the size (sorted) of only the folders in this directory
alias folders="find . -maxdepth 1 -type d -print | xargs du -sk | sort -rn"