-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.zshrc
164 lines (137 loc) · 5.19 KB
/
.zshrc
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
158
159
160
161
162
163
164
alias profile='nano ~/.zshrc'
alias reload='source ~/.zshrc && echo "Done"'
alias hosts='sudo nano /etc/hosts'
alias gitconfig='nano ~/.gitconfig'
alias rm='trash'
alias cat='bat'
# Grabs the disk usage in the current directory
alias usage='du -ch | grep total'
# Gets the total disk usage on your machine
alias totalusage='df -hl --total | grep total'
# Shows the individual partition usages without the temporary memory values
alias partusage='df -hlT --exclude-type=tmpfs --exclude-type=devtmpfs'
# Gives you what is using the most space. Both directories and files. Varies on current directory
alias most='du -hsx * | sort -rh | head -10'
# copy the working directory path
alias cpwd='pwd|tr -d "\n" | pbcopy'
#I can just run "up" to "cd ..", or I can run "up 6" to "cd ../../../../../.."
function up {
if [[ "$#" < 1 ]] ; then
cd ..
else
CDSTR=""
for i in {1..$1} ; do
CDSTR="../$CDSTR"
done
cd $CDSTR
fi
}
# ----------------------------------------Aravind bashrc ----------------------------------------
alias cls="clear"
alias c="clear"
alias ltr="ls -ltrFh"
#-F appends symbols to filenames.
alias lta="ls -alFh"
#list only directories
alias ld='ls -ldh */'
#list only files (exclude hidden files)
alias lf='ls -lph | grep -v /'
#list only files (include hidden files)
alias lfa='ls -alph | grep -v /'
alias l.="ls -A | egrep '^\.'" # List only dotfiles (hidden files)
# Open the current directory in Finder (Mac only)
alias o="open ."
## a quick way to get out of current directory ##
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../..'
alias ~="cd ~"
#History
alias hist='history'
alias h='history'
alias h1="history 10"
alias h2="history 15"
alias h3="history 20"
#Hisotry search (use: hs sometext)
alias hs='history | grep $1'
## Colorize the grep command output for ease of use (good for log files)##
alias grep='grep --color=auto'
# install colordiff package :)
alias cdiff='colordiff'
#pretty format json using python tool
#usage: prettyjson file.json
#OR pipe unformatted to these to nicely format the JSON e.g. cat file.json | prettyjson
alias prettyjson='python -m json.tool'
alias json="python -m json.tool"
#git
alias gi='git init'
alias gs='git status '
alias ga='git add '
alias gb='git branch '
alias gc='git commit -m'
alias gca='git commit --amend -m'
alias gp='git push origin master'
alias gd='git diff'
alias go='git checkout '
alias gl='git log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate'
alias gld='git log --pretty=format:"%h %ad %s" --date=short --all'
alias gsl='git shortlog'
#List repository contributors by author name (sorted by name):
alias gslu='git log --format='%aN' | sort -u'
#List total commits by author (sorted by commit count)
alias gslc='git shortlog -sn'
#List file change stats by author
gsu() { git log --shortstat --author="$1" | grep -E "fil(e|es) changed" | awk '{files+=$1; inserted+=$4; deleted+=$6; delta+=$4-$6; ratio=deleted/inserted} END {printf "Commit stats:\n- Files changed (total).. %s\n- Lines added (total).... %s\n- Lines deleted (total).. %s\n- Total lines (delta).... %s\n- Add./Del. ratio (1:n).. 1 : %s\n", files, inserted, deleted, delta, ratio }' - ;}
#List what changed since given date
gw() { git whatchanged --since "$1" --oneline --name-only --pretty=format: | sort | uniq; }
# Git log find by commit message
glf() { git log --all --grep="$1"; }
#tar
alias untar='tar -zxvf '
#know your external IP address
alias ipe='curl ipinfo.io/ip'
#know your local/internal IP address
alias ipi='ipconfig getifaddr en0'
#repository
alias aptu='sudo apt-get update && sudo apt-get upgrade'
## pass options to free ##
alias meminfo='free -m -l -t'
## get top process eating memory
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
## get top process eating cpu ##
alias pscpu='ps auxf | sort -nr -k 3'
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
## Get server cpu info ##
alias cpuinfo='lscpu'
## older system use /proc/cpuinfo ##
##alias cpuinfo='less /proc/cpuinfo' ##
## get GPU ram on desktop / laptop##
alias gpumeminfo='grep -i --color memory /var/log/Xorg.0.log'
# Edit shortcuts for config files
alias sshconfig="${EDITOR:-nano} ~/.ssh/config"
alias bashrc="${EDITOR:-nano} +120 ~/.bashrc && source ~/.bashrc && echo Bash config edited and reloaded."
#Maven
alias mvni='mvn clean install'
alias mvnc='mvn clean compile'
alias mvnp='mvn clean package'
# Prompt
#BGREEN='\[\033[1;32m\]'
#GREEN='\[\033[0;32m\]'
#BRED='\[\033[1;31m\]'
#RED='\[\033[0;31m\]'
#BBLUE='\[\033[1;34m\]'
#BLUE='\[\033[0;34m\]'
#NORMAL='\[\033[00m\]'
#PS1="${BLUE}(${RED}\w${BLUE}) ${NORMAL}\h ${RED}\$ ${NORMAL}"
# Default editor to Nano - http://stackoverflow.com/questions/41866734/what-is-the-advantage-of-setting-a-default-editor-for-bash
export EDITOR=/usr/bin/nano
# brew_install_apps.sh - Appending JAVA_HOME env var
export JAVA_HOME=
# brew_install_apps.sh - Appending JAVA_HOME env var
export JAVA_HOME=/Library/Java/JavaVirtualMachines/microsoft-11.jdk/Contents/Home
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"