-
Notifications
You must be signed in to change notification settings - Fork 1
/
.shaliases
185 lines (162 loc) · 7.48 KB
/
.shaliases
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
#
# .shaliases - common aliases for Ksh and clones, Ash, etc.
#
#ident "@(#)HOME:.shaliases 37.5 24/10/20 14:53:43 (woods)"
if $ISSUN; then
alias df="/usr/bin/df"
fi
if [ $(uname -s) = "Darwin" ]; then
# N.B. The OS product version can be found with /usr/bin/sw_vers
# it's not the same, but it has similar uses...
alias ldd="otool -L"
# macOS 'df' has a nasty bug in parsing its options and cannot
# see any past the first '-t' (which is apparently
# deprecated), so be sure to use '-T'
#
alias df="/bin/df -P -T nonullfs"
fi
if [ -x $LOCAL/bin/man ] ; then
alias man=$LOCAL/bin/man
alias osman='MANPATH=$OMANPATH /usr/bin/man'
else
alias osman='MANPATH=$OMANPATH man'
fi
alias gman='MANPATH=$GNU/man man'
alias lman='MANPATH=$LOCAL/share/man man'
alias pkgman='MANPATH=$PKG/share/man man'
alias optman='MANPATH=$SLASHOPT/share/man man'
alias tkman='MANPATH=$LOCAL/share/man.tcltk man'
if ${HAVEX}; then
alias x11man='MANPATH=$X11PATH/man man'
# XXX this is probably only necessary on macos where they don't run the
# "retina" displays at full resolution and you're already in a GUI....
alias goX11='xrandr -s $(xrandr 2>/dev/null | awk "/^Screen [0-9]+:/ {print \$(NF-2) \"x\" \$(NF)}")'
fi
if $HAVETPUT; then
alias c='tput clear'
alias clear='tput clear'
else
alias c='clear'
fi
if $HAVEMUSH; then
alias mfrom='mush -H:n'
alias mhdrs='mush -H -f'
fi
# (note: sh "read" command also reads backslash continued lines)
# XXX need an option to strip leading whitespace on continued lines
alias backslashjoin='sed -e :a -e "/\\\\$/N; s/\\\\\\n//; ta"'
# delete all CONSECUTIVE blank lines from file except the first; also
# deletes all blank lines from top and end of file (emulates "cat -s")
# method 1, allows 0 blanks at top, 1 at EOF
# NOTE: never forget this -- it's the most incredible little sed script!!!!
alias blsqueeze='sed "/./,/^$/!d"'
# method 2, allows 1 blank at top, 0 at EOF
alias blsqueezebot="sed '/^$/N;/\n$/D'"
# delete all CONSECUTIVE blank lines from file except the first 2:
alias blsqueezenot2="sed '/^$/N;/\n$/N;//D'"
# delete ALL blank lines from a file (same as "grep '.' ")
alias blstrip='sed "/./!d"'
alias blstrip2="sed '/^$/d'"
# delete all leading blank lines at top of file
alias blstriptop="sed '/./,$!d'"
# delete all trailing blank lines at end of file
alias blstripbot="sed -e :a -e '/^\n*$/N;/\n$/ba'"
# reverse order of lines (emulates "tac")
alias sed-tac="sed '1!G;h;$!d'"
# reverse each character on the line (emulates "rev")
alias sed-rev="sed '/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//'"
# join pairs of lines side-by-side (like "paste")
alias sed-paste="sed 'N;s/\n/ /'"
# delete duplicate lines from a sorted file (emulates "uniq"). First
# line in a set of duplicate lines is kept, the rest are deleted
alias sed-uniq="sed '$!N; /^\(.*\)\n\1$/!P; D'"
# NOTE: replacing the last '-print' with '-exec CMD {} +' lets one use 'CMD' directly on the files
alias pkgfind="find . -type d -name CVS -prune -or -type f \( -name 'Make*' -or -name '*.mk' \) ! -name '.#*' ! -name '#*#' ! -name '*~' ! -name .cvsignore -print"
alias cvsfind="find . -type d -name CVS -prune -or -type f ! -name '.#*' ! -name '#*#' ! -name '*~' ! -name .cvsignore ! -name '[Tt][Aa][Gg][Ss]' -print"
alias cvsfind0="find . -type d -name CVS -prune -or -type f ! -name '.#*' ! -name '#*#' ! -name '*~' ! -name .cvsignore ! -name '[Tt][Aa][Gg][Ss]' -print0"
alias srcfind="find . -type d \( -name CVS -or -name .git -or -name .svn -or -name build -or -name 'build-*' -or -name autom4te.cache \) -prune -or -type f ! -name '.#*' ! -name '#*#' ! -name '*~' ! -name '.*ignore' ! -name '[Tt][Aa][Gg][Ss]' -print"
alias srcfind0="find . -type d \( -name CVS -or -name .git -or -name .svn -or -name build -or -name 'build-*' -or -name autom4te.cache \) -prune -or -type f ! -name '.#*' ! -name '#*#' ! -name '*~' ! -name '.*ignore' ! -name '[Tt][Aa][Gg][Ss]' -print0"
alias deadlinks='find . -type l -a ! \( -follow -type f \) -print'
alias ds='$PAGER'
alias e='${VISUAL:-$EDITOR}'
alias ealias='e $ENV'
alias elc='${MY_EMACS} -batch -q -no-site-file -f batch-byte-compile'
alias f='finger'
# Note: use "findls" as the prefix where globbing will exceed ARG_MAX
# "find" never lists the '..' entry, so if you also exclude the '.'
# entry and then apply "-prune" to all the remaining entries, find
# certainly won't descend into any sub-directory. This is an
# alternative to using "-maxdepth 1" (which is not in POSIX.2)
# Don't list directories and links by appending "! -type d ! -type l"
alias findls='find . ! -name . -prune'
alias funclist='typeset +f'
alias gitfind='git ls-tree -r --name-only HEAD'
alias h='fc -l'
alias history='fc -l 1'
alias hmeme='fc -l 1 | awk "\$1 > 0 {print \$2}" | sort | uniq -c | sort -rn | sed 20q'
alias isodate='LANG=c date "+%Y-%m-%dT%H:%M:0z"'
alias j='jobs -l'
alias l='${LS} -CF'
alias la='${LS} -CFa'
alias lD='${LS} -CFd'
alias lL='${LS} -CFL'
alias ll='${LS} -l${LS_O}s'
alias lli='${LS} -l${LS_O}is'
alias llD='${LS} -l${LS_O}sd'
alias llL='${LS} -l${LS_O}sL'
alias lla='${LS} -l${LS_O}sa'
alias llia='${LS} -l${LS_O}isa'
alias llai='${LS} -l${LS_O}isa'
alias lld='${LS} -l${LS_O}sd'
alias llr='${LS} -l${LS_O}sR'
alias llir='${LS} -l${LS_O}isR'
alias llra='${LS} -l${LS_O}saR'
alias llira='${LS} -l${LS_O}isaR'
alias lr='${LS} -CFR'
alias lra='${LS} -CFRa'
alias lsa='${LS} -as'
alias lss='${LS} -s'
alias logout='exit 0'
alias maildate='LANG=c date "+%a, %d %b %Y %T %z"'
alias nosgr='echo '
alias nstty='stty sane intr "^?" erase "^h" kill "^u" echoe echok'
alias pkg_sizes="/usr/sbin/pkg_info -s \* | sed -e '/^$/d' -e 's/Information for //' -e 's/:$/:\\\\/' | sed -e :a -e '$!N;s/Size of this package in bytes://;ta' -e 'P;D' | backslashjoin"
alias realias='let LEV=$LEV-1;exec ${SHELL}' # useless?
alias rehash='_SV_PATH=$PATH; PATH=$_SV_PATH; unset _SV_PATH'
alias rinfo='rlog -L -h -l $(find RCS -type f -print)'
# use 'tput reset', and/or 'tabs -8' to reset tabs, etc. -- i.e. terminal (emulator) features
alias rstty='stty $SANE'
alias rsyncbackup='rsync -a -H -E --numeric-ids'
alias scvs='export CVSROOT="$(< CVS/Root)"; echo "CVSROOT=$CVSROOT"'
alias snmpoidinfo='snmptranslate -T d -O f'
alias wcvs="echo \$CVSROOT"
alias zds="z$PAGER"
alias dlog='$PAGER -en +G /var/log/debug'
alias ilog='$PAGER -en +G /var/log/important'
alias klog='$PAGER -en +G /var/log/kern'
alias mlog='$PAGER -en +G /var/log/messages'
# Smail related tools...
#
alias badsenders='fgrep RHSBL: $MAILLOG | sed "s/[<>]/ /g" | awk "{print \$8}" | sort -u'
alias rblcount='fgrep " matched " $MAILLOG | cut -d " " -f 13 | cut -d . -f 5- | sort | uniq -c'
alias rblstats='fgrep " matched " $MAILLOG | cut -d " " -f 10- | sort | uniq -c | sort -n | ds'
# This is only useful on SysV and NetBSD-5 and newer
alias fw='who -HaT' # xxx the T shouldn't be necessary, but is on stock NetBSD
# these are only useful on SysV
#alias lpq='lpstat -o'
# TODO: find a test so these are usable.
#alias nstty='stty sane intr "^?" erase "^h" kill "^u" echoe echok rows $LINES cols $COLUMNS'
#alias rstty='stty $SANE; stty rows ${LINES:-$(tput lines)} cols ${COLUMNS:-$(tput cols)}'
# TODO: find a way to test if HoneyDanBer UUCP or not....
# (other than [ -d /etc/uucp ]) (also, only if HAVEUUSTAT!)
alias uuq='uustat -a'
# TODO: should only set this if "xtail" and UUCP are both available?
if [ -d /var/spool/uucp ] ; then
alias uufollow='xtail /var/spool/uucp/.[AL]*/*'
elif [ -d /usr/spool/uucp ]; then
alias uufollow='xtail /usr/spool/uucp/.[AL]*/*'
fi
# This is silly, but it usually works....
if [ -x /usr/ucb/rsh -a -x /bin/rsh ] ; then
alias rsh=/usr/ucb/rsh
fi