-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaliases
156 lines (123 loc) · 4.04 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
# https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/plugins/common-aliases/common-aliases.plugin.zsh
#
# Advanced Aliases.
# Use with caution
unalias ls
alias ls='eza'
# ls, the common ones I use a lot shortened for rapid fire usage
alias l='ls -lh' # size,show type,human readable
alias la='ls -lAh' # long list,show almost all,show type,human readable
alias lr='ls -tRh' # sorted by date,recursive,show type,human readable
alias lt='ls -lth' # long list,sorted by date,show type,human readable
alias ll='ls -l' # long list
alias ldot='ls -ld .*'
alias lS='ls -1Ssh'
alias lart='ls -1cart'
alias lrt='ls -1crt'
alias lsr='ls -lARh' # Recursive list of files and directories
alias lsn='ls -1' # A column contains name of files and directories
alias zshrc='${=EDITOR} ${ZDOTDIR:-$HOME}/.zshrc' # Quick access to the .zshrc file
alias grep='grep --color'
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
alias t='tail -f'
# Command line head / tail shortcuts
alias -g H='| head'
alias -g T='| tail'
alias -g G='| grep'
alias -g L="| less"
alias -g M="| most"
alias -g LL="2>&1 | less"
alias -g CA="2>&1 | cat -A"
alias -g NE="2> /dev/null"
alias -g NUL="> /dev/null 2>&1"
alias -g P="2>&1| pygmentize -l pytb"
alias dud='du -d 1 -h'
alias duf='du -sh *'
alias h='history'
alias hgrep="fc -El 0 | grep"
alias help='man'
alias p='ps -f'
alias sortnr='sort -n -r'
alias unexport='unset'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# zsh is able to auto-do some kungfoo
# depends on the SUFFIX :)
if is-at-least 4.2.0; then
# open browser on urls
if [[ -n "$BROWSER" ]]; then
_browser_fts=(htm html de org net com at cx nl se dk)
for ft in $_browser_fts; do alias -s $ft=$BROWSER; done
fi
_editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex)
for ft in $_editor_fts; do alias -s $ft=$EDITOR; done
if [[ -n "$XIVIEWER" ]]; then
_image_fts=(jpg jpeg png gif mng tiff tif xpm)
for ft in $_image_fts; do alias -s $ft=$XIVIEWER; done
fi
_media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
for ft in $_media_fts; do alias -s $ft=mplayer; done
#read documents
alias -s pdf=acroread
alias -s ps=gv
alias -s dvi=xdvi
alias -s chm=xchm
alias -s djvu=djview
#list whats inside packed file
alias -s zip="unzip -l"
alias -s rar="unrar l"
alias -s tar="tar tf"
alias -s tar.gz="echo "
alias -s ace="unace l"
fi
###
# Changing/making/removing directory
setopt auto_pushd
setopt pushd_ignore_dups
setopt pushdminus
alias -g ...='../..'
alias -g ....='../../..'
alias -g .....='../../../..'
alias -g ......='../../../../..'
alias -- -='cd -'
alias 1='cd -'
alias 2='cd -2'
alias 3='cd -3'
alias 4='cd -4'
alias 5='cd -5'
alias 6='cd -6'
alias 7='cd -7'
alias 8='cd -8'
alias 9='cd -9'
###
alias ncdu="ncdu --color dark -rr -x --exclude .git"
### Python
alias python='python3'
alias pip='pip3'
### Vim
alias vim='nvim'
### Kubernetes
# list the container images of each pod
alias kli='kubectl get pods -o custom-columns="NAME:metadata.name,IMAGES:spec.containers[*].image"'
# Get current context
alias krc='kubectl config current-context'
# List all contexts
alias klc='kubectl config get-contexts -o name | sed "s/^/ /;\|^ $(krc)$|s/ /*/"'
# Change current context
alias kcc='kubectl config use-context "$(klc | fzf -e | sed "s/^..//")"'
# Get current namespace
alias krn='kubectl config get-contexts --no-headers "$(krc)" | awk "{print \$5}" | sed "s/^$/default/"'
# List all namespaces
alias kln='kubectl get -o name ns | sed "s|^.*/| |;\|$(krn)|s/ /*/"'
# Change current namespace
alias kcn='kubectl config set-context --current --namespace "$(kln | fzf -e | sed "s/^..//")"'
# Turn on spaceship prompt
alias kshow="export SPACESHIP_KUBECTL_SHOW=true"
# zx1986
alias preview="fzf --preview 'bat --color \"always\" {}'"
alias json="python -mjson.tool"
alias xml="xmllint --format -"
alias dns="sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder"
alias rt="sudo route -n flush; sudo route -n flush; sudo route -n flush; netstat -nr"
alias jump="ssh -p ${JUMPPORT} ${JUMPSERVER}"