-
Notifications
You must be signed in to change notification settings - Fork 0
/
aliases
295 lines (244 loc) · 7.29 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
#
# shell command line aliases
# used for interactive shells only
#
# TODO: split this out into ~/.bash/alias.d/
# TODO: arg syntax is ugly with all the quotes, rethink
#
alias ()
{
local name argn commands
if (($# < 2)); then
echo "$FUNCNAME: need 2+ args ($@)" >&2; return 1; fi
name=$1; shift
for ((argn = 1; argn <= $#; argn++)); do
commands+="${!argn}"; done
# TODO: this may not be needed anymore because we only
# keep it for the lifetime of this source file, so the
# unalias -a that is run at the top probably takes
# care of what we need done already
#
builtin alias -- $name &>/dev/null &&
builtin unalias -- $name &>/dev/null
eval builtin alias '"$name"="$commands"'
}
builtin unalias -a # for renames
##############################################################################
### bash
alias j "jobs -l"
alias lj "jobs -l | fmt -ts | pycolor"
alias m "fg -"
alias f "fg"
alias fm "fg -"
alias fp "fg +"
alias realias "source ~/.bash/init.d/aliases"
alias rebind "echo re-read-init-file | bind"
alias recomplete "source ~/.bash/init.d/completions"
alias reenv "source ~/.bash/setenv; source ~/.bash/init.d/env"
alias reinit "source ~/.bash/rc"
alias recmd "realias; refunc"
alias initbash "reinit "
alias bashinit "reinit "
alias bashrc "reinit "
alias bashver 'echo ${BASH_VERSINFO[@]}'
doaliases ()
{ local i; for ((i = 1; i <= 64; i++)); do alias $i "fg $i"; done; }
doaliases
# "cd -" with less characters and no output
#
enable -n .
alias . "cd \$OLDPWD"
alias .. "cd .."
alias ... "cd ../.."
alias .... "cd ../../.."
alias ..... "cd ../../../.."
alias ...... "cd ../../../../.."
alias ....... "cd ../../../../../.."
alias ........ "cd ../../../../../../.."
alias ......... "cd ../../../../../../../.."
alias disable "enable -n"
alias dirs "command dirs -p -v"
### list
alias lsvar "compgen -A variable"
alias lsfile "compgen -A file"
alias lsdir "compgen -A directory"
alias lsarr "compgen -A arrayvar"
alias lstags "grep '^[[:alnum:]_-]+:' Makefile"
### utility
alias nowdatefmt "date +\$HISTTIMEFORMAT"
#alias wordcount "wc -w"
#alias count "wc -l"
#alias linecount "wc -l"
alias addrof "gethostip -d"
alias ping1 "ping -c 1"
alias ipls "ip addr ls | " \
"grep 'inet.*/' | " \
"awk '{print \$2, \$NF}' | " \
"column -t" \
;
alias lastmodf "ls -1t \$(" \
"find . " \
"-mindepth 1 " \
"-maxdepth 1 " \
"-type f" \
") | " \
"head -1 | " \
"sed 's,^\./,,'"
alias lastmodd "ls -1dt \$(" \
"find . " \
"-mindepth 1 " \
"-maxdepth 1 " \
"-type d" \
") | " \
"head -1 | " \
"sed 's,^\./,,'"
### history
# these should probably not be here because they are stale since we do this in
# PROMPT_COMMAND at the moment --smm20131213205903
#
#alias histon "source ~/.bash/init.d/history; " \
# "source ~/.bash/init.d/aktools"
#
#alias histoff "unset HISTFILE; " \
# "AKASSOC=\${AKASSOC:+histoff}; " \
# "unset \${AKASSOC:-AKASSOC} "
#
#alias histwrite "history -w"
#alias histread "history -r"
#
alias histadd "history -s"
alias rml "histrmlast"
alias rml2 "histrm2ndlast"
alias rm2l "histrm2ndlast"
### terminal
alias cls "cd; clear; reset"
alias lock "clear; su -c 'vlock -a'"
alias wrapon "setterm -linewrap on"
alias wrapoff "setterm -linewrap off"
alias upper "head -\$((LINES - 3))" # vertical size of PS1
alias bottom "tail -\$((LINES - 3))"
alias half "head -\$(((LINES - 3) / 2))"
alias cutwrap "expand | cut -b 1-\$COLUMNS"
alias nowrap "cutwrap "
alias firstline "head -1"
alias lastline "tail -1"
alias header "awk '/^\$/ {exit} {print}'"
### grep
alias _grep "command grep " \
"--exclude='*.svn-base' " \
"--exclude='entries' " \
"--binary-files=without-match " \
"--devices=skip " \
"--directories=skip " \
"--extended-regexp " \
"--no-messages"
alias cgrep "_grep --color=always"
alias rgrep "_grep --directories=recurse"
alias lgrep "grep --line-buffered"
alias legrep "grep -E --line-buffered"
### mail
alias fml "fetchmail | fml.awk"
alias sml "sendmail -q"
alias yml "mailsync -t md5 work-all"
alias work "mutt -f =work"
alias personal "mutt -f =personal"
alias private "mutt -f =private"
alias sent "mutt -f =sent"
alias inbox "mutt"
alias muttdoc "zless /usr/share/doc/mutt*/manual.txt.gz"
### package management
alias yumdev "yum -q --disablerepo='*' --enablerepo=rawhide"
alias yumsrc "yum -q --disablerepo='*' --enablerepo=fedora-source"
alias rpmi "rpm -qi"
alias rpminfo "rpmi "
alias rpmlist "rpm -ql"
### aktools
alias aka "ak assoc"
alias aka "ak assoc"
alias akanf "ak assocnf"
alias akl "ak assoclast"
alias akr "ak recent | head"
alias aklas "(" \
"cd ~/var/bash/history; " \
"ls -1t \$(" \
"find . " \
"-mindepth 1 " \
"-maxdepth 1 " \
"-type f" \
") | " \
"sed 's,^\./,,' | " \
"column -x" \
")"
alias akdolast "akdolast 1"
### administration
alias s "sudo"
alias si "sudo -i"
alias svim "sudo -e"
alias inc "incus"
alias sincus "sudo incus"
alias permsave "(cd /etc; sudo metastore -s /etc; cd \$OLDPWD)"
alias permrestore "(cd /etc; sudo metastore -ae /etc; cd \$OLDPWD)"
alias permchk "(cd /etc; sudo metastore -c /etc; cd \$OLDPWD)"
alias mounts "findmnt -t nosquashfs" # snapd loopback mounts suck
### ssh
alias sshr "ssh -ql root"
alias sshn "ssh -o controlpath=none"
### uncategorized / TODO
alias a "tmux attach"
alias h "hostname"
alias oda "od -aAn"
alias odax "od -An -a -t x1"
alias g "elinks https://www.google.com/"
alias cvim "vim -S ~/.cvimrc" # secure vim without temp files
alias lds "ldapsearch -LLLx"
alias mix "alsamixer -c 0"
alias eq "alsamixer -D eq"
#alias man "pinfo -m"
alias mann "command man"
alias manw "MANWIDTH= command man"
alias rpn "orpie"
alias xrun "DISPLAY=:0"
alias vimhelp "vim -c help"
alias vimro "vim -R"
alias rel "lsb_release -si"
alias ncal "ncal -Mw"
alias xv "pqiv -f"
alias xpdf "xpdf -z width -fullscreen"
alias shred "shred -zun 50"
alias aptpats "elinks /usr/share/doc/aptitude/html/en/ch02s04s05.html"
alias ggw "GGBROWSER=vimb gg"
alias gcpinit "source /usr/share/google-cloud-sdk/completion.bash.inc"
alias ansplay "ansible-playbook"
alias ansdoc "ansible-doc"
alias yamlref "elinks http://www.yaml.org/refcard.html"
alias coll "dshbak -c"
alias pdshr "pdsh -l root"
alias pdshx "pdsh -X pdsh_all_skip"
alias pdshrx "pdsh -X pdsh_all_skip -l root"
alias pdcpr "pdcp -l root"
alias pdcpx "pdcp -X pdsh_all_skip"
alias pdcprx "pdcp -X pdsh_all_skip -l root"
alias activate "source bin/activate"
alias py "python3 -q"
alias pydoc "pydoc3"
alias wd "cd ~/work/src; cd"
alias xclipp "xclip -selection primary"
alias xclips "xclip -selection secondary"
alias xclipc "xclip -selection clipboard"
alias mnl "TZ=Asia/Manila"
alias ist "TZ=Asia/Kolkata"
alias cdg "TZ=Europe/Paris"
alias roc "TZ=US/Eastern"
alias aus "TZ=US/Central"
alias den "TZ=US/Mountain"
alias sfo "TZ=US/Pacific"
alias utc "TZ=Etc/UTC"
alias fwup "sudo sh -c '" \
"systemctl unmask fwupd polkit udisks2; " \
"systemctl start polkit udisks2; " \
"systemctl start fwupd; " \
"sudo fwupdmgr update; " \
"sudo systemctl stop fwupd polkit udisks2" \
"sudo systemctl mask fwupd polkit udisks2" \
"'"
unset -f alias