forked from jimlawton/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aliases
157 lines (127 loc) · 7.88 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/sh
#########################################
# Connectivity
#########################################
# Commands to run apps
#########################################
# Commands to change dirs
alias to.dotfiles='cd ~/.dotfiles'
alias to.dropbox='cd ~/Dropbox'
alias to.desktop='cd ~/Desktop'
alias to.docs='cd ~/Documents'
alias to.git='cd ~/git'
#################################
# Simple Program Name Shortening
#alias g=git
#############################
# Utilities
alias zipall='for D in *; do zip -r "$D" "$D"; done'
alias hexdumpfile='od -h'
# Git shortcuts
alias gs='git status'
alias gpl='git pull'
alias gps='git push'
alias gsy='git pull && git push'
# repo shortcuts
alias rsy='repo sync'
alias rsy='repo sync'
alias rst='repo status'
alias rpu='repo forall -e -c git push'
alias rcm='repo forall -e -c git checkout master'
# Show network connections
# Often useful to prefix with SUDO to see more system level network usage
alias network.connections='lsof -l -i +L -R -V'
alias network.established='lsof -l -i +L -R -V | grep ESTABLISHED'
alias network.internalip="ifconfig en0 | egrep -o '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)'"
alias network.externalip='curl -s http://checkip.dyndns.org/ | sed "s/[a-zA-Z<>/ :]//g"'
# Files used, anywhere on the filesystem
alias files.usage='sudo fs_usage -e -f filesystem|grep -v CACHE_HIT|grep -v grep'
# Files being opened
alias files.open='sudo fs_usage -e -f filesystem|grep -v CACHE_HIT|grep -v grep|grep open'
# Files in use in the Users directory
alias files.usage.user='sudo fs_usage -e -f filesystem|grep -v CACHE_HIT|grep -v grep|grep Users'
# Directory listings
# LS_COLORS='no=01;37:fi=01;37:di=07;96:ln=01;36:pi=01;32:so=01;35:do=01;35:bd=01;33:cd=01;33:ex=01;31:mi=00;05;37:or=00;05;37:'
# -G Add colors to ls
# -l Long format
# -h Short size suffixes (B, K, M, G, P)
# -p Postpend slash to folders
alias ls='ls -G -h -p '
alias ll='ls -l -G -h -p '
if isLinux; then
alias ls='ls --color=auto'
fi
alias ls-l='ls -l'
alias ls-lt='ls -lt'
alias latest='ls -alt | head -20'
alias lessc='less -R' # Lets color escape sequences carry through to less
alias morec='more -R'
alias lesscolor='less -R'
alias morecolor='more -R'
alias nasquota='ssh svn /home/nasadmin/nasquota/cur/bin/nasquota'
alias prettyprint='enscript --pretty-print --color -2 -r'
if [ -f /usr/bin/colordiff ]; then
alias diff='colordiff'
fi
alias grep='grep --color=auto --exclude=.svn'
alias egrep='egrep --color=auto --exclude=.svn'
alias fgrep='fgrep --color=auto --exclude=.svn'
#alias sortlog='cat logs/`ls -t logs/ | head -1` | grep '^NDS' | sort -n'
alias sortlog='cat logs/`ls -t logs/ | head -1` | grep '^NDS' | sort -n >sortedlog.log; dos2unix -q sortedlog.log'
alias prunelog='cat sortedlog.log | grep WLM | grep -v SERVER_HTTP_IsValidKeyword | grep -v SERVER_HTTP_SetValue | grep -v SERVER_HTTP_ExtractValue | grep -v ClearReceiveMessageBuffer | grep -v ClearTransmitMessageBuffer | grep -v CopyToTransmitBuffer | grep -v CopyFromReceiveBuffer | grep -v SERVER_ReadConfigFile | grep -v SERVER_HTTP_SetKeywordTable | grep -v SERVER_HTTP_ClearBuffer > prunedlog.log'
#alias vilastlog='vi logs/`ls -t logs/ | head -1`'
alias vilastlog='vi `ls -t *.log | head -1`'
alias catlastlog='cat logs/`ls -t logs/ | head -1`'
alias brokenlinks='find . -type l | (while read FN ; do test -e "$FN" || ls -ld "$FN"; done)'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
#alias cd='cd \!*; pwd'
#alias cd='pushd !*'
#alias more=less
#alias du='du --exclude=.svn'
alias now='date +"%Y%m%d-%H%M%S"'
alias minicom='minicom -C minicom-`now`.log'
#alias svnst='svn st --ignore-externals'
#alias svnup='svn up --ignore-externals'
alias svnrepos='export REPOS=$(~/utils/svnrepos -r) ; echo $REPOS'
alias svnurl='svn info | awk "/^URL:/ {print}" | sed "s/^URL: //"'
alias svndot='svn info | awk "/^URL:/ {print}" | sed "s/^URL: //"'
alias svndotdot='svn info .. | awk '\''/^URL:/ {print}'\'' | sed '\''s/^URL: //'\'''
alias svndiff='svn diff --diff-cmd=xx-diff-proxy'
# shortcuts for doing process stuff
alias pgrep='ps auxww | grep \!* | grep -v grep'
#alias pfind='pgrep \!* | awk "{print \${2}}"'
#alias a2ps='a2ps -r -1 -C -E -g -l120 -s2 --toc'
#alias a2ps='a2ps -r -1 -C -E -g -l120 -s2'
alias a2ps='a2ps --landscape -1 --line-numbers=5 --pretty-print --highlight-level=heavy --chars-per-line=120 --sides=duplex --prologue=color'
alias mfind='find . \( -name .svn -prune \) -o \( -xtype f \( -name "Makefile*" -o -name "*makefile*" -o -name "*\.mk" -o -name "*\.mak" -o -name build.xml \) -print \) | xargs -r egrep --color=auto -n'
alias mnotfind='find . \( -name .svn -prune \) -o \( -xtype f \( -name "Makefile*" -o -name "*makefile*" -o -name "*\.mk" -o -name "*\.mak" -o -name build.xml \) -print \) | xargs -r egrep --color=auto -n -v'
alias sfind='find . \( -name .svn -prune \) -o \( -xtype f \( -name "*\.[dDhHcCsS]" -o -name "*\.cc" -o -name "*\.cpp" -o -name "*\.java" -o -name "*\.py" \) -print \) | xargs -r egrep --color=auto -n'
alias snotfind='find . \( -name .svn -prune \) -o \( -xtype f \( -name "*\.[dDhHcCsS]" -o -name "*\.cc" -o -name "*\.cpp" -o -name "*\.java" -o -name "*\.py" \) -print \) | xargs -r egrep --color=auto -n -v'
alias shfind='find . \( -name .svn -prune \) -o \( -xtype f \( -name "*\.sh" -o -name "*\.csh" -o -name "*\.zsh" -o -name "*\.tcsh" \) -print \) | xargs -r egrep --color=auto -n'
alias shnotfind='find . \( -name .svn -prune \) -o \( -xtype f \( -name "*\.sh" -o -name "*\.csh" -o -name "*\.zsh" -o -name "*\.tcsh" \) -print \) | xargs -r egrep --color=auto -n -v'
alias cfind='find . \( -name .svn -prune \) -o \( -xtype f \( -name "*\.[cCsS]" -o -name "*\.cc" -o -name "*\.cpp" \) -print \) | xargs -r egrep --color=auto -n'
alias cnotfind='find . \( -name .svn -prune \) -o \( -xtype f \( -name "*\.[cCsS]" -o -name "*\.cc" -o -name "*\.cpp" \) -print \) | xargs -r egrep --color=auto -n -v'
alias hfind='find . \( -name .svn -prune \) -o \( -xtype f -name "*\.[hH]" -print \) | xargs -r egrep --color=auto -n'
alias hnotfind='find . \( -name .svn -prune \) -o \( -xtype f -name "*\.[hH]" -print \) | xargs -r egrep --color=auto -n -v'
alias jfind='find . \( -name .svn -prune \) -o \( -xtype f -name "*\.java" -print \) | xargs -r egrep --color=auto -n'
alias jnotfind='find . \( -name .svn -prune \) -o \( -xtype f -name "*\.java" -print \) | xargs -r egrep --color=auto -n -v'
alias pyfind='find . \( -name .svn -prune \) -o \( -xtype f -name "*\.py" -print \) | xargs -r egrep --color=auto -n'
alias pynotfind='find . \( -name .svn -prune \) -o \( -xtype f -name "*\.py" -print \) | xargs -r egrep --color=auto -n -v'
alias dfind='find . \( -name .svn -prune \) -o \( -xtype f -name "*\.[dD]" -print \) | xargs -r egrep --color=auto -n'
alias dnotfind='find . \( -name .svn -prune \) -o \( -xtype f -name "*\.[dD]" -print \) | xargs -r egrep --color=auto -n -v'
alias ofind='find . \( -name .svn -prune \) -o \( -xtype f -name "*\.o" -print \) | xargs -r nm | egrep --color=auto -n'
alias rstfind='find . \( -name .svn -prune \) -o \( -xtype f \( -name "*\.rst" \) -print \) | xargs -r egrep --color=auto -n'
alias rstnotfind='find . \( -name .svn -prune \) -o \( -xtype f \( -name "*\.rst" \) -print \) | xargs -r egrep --color=auto -n -v'
if [ -f /opt/cxoffice/bin/wine -a -d /home/$USER/.cxoffice/Microsoft\ Office\ 2010 ]; then
alias word="/opt/cxoffice/bin/wine --bottle /home/$USER/.cxoffice/Microsoft\ Office\ 2010 --cx-app winword.exe"
alias excel="/opt/cxoffice/bin/wine --bottle /home/$USER/.cxoffice/Microsoft\ Office\ 2010 --cx-app excel.exe"
alias powerpnt="/opt/cxoffice/bin/wine --bottle /home/$USER/.cxoffice/Microsoft\ Office\ 2010 --cx-app powerpnt.exe"
alias visio="/opt/cxoffice/bin/wine --bottle /home/$USER/.cxoffice/Microsoft\ Visio\ 2010 --cx-app visio.exe"
fi
# History search.
alias hgrep='history|grep --color'
alias phgrep='cat ~/.persistent_history|grep --color'
# Kill ssh or sshpass sessions (e.g. if VPN hangs).
alias sshkill="ps auxww | egrep 'sshpass|ssh ' | egrep -v egrep | awk '{print \$2}' | xargs kill -9"