-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.shaliases
More file actions
126 lines (111 loc) · 5.71 KB
/
.shaliases
File metadata and controls
126 lines (111 loc) · 5.71 KB
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
#
# .shaliases - common aliases for Ksh and clones, Ash, etc.
#
#ident "@(#)HOME:.shaliases 37.8 25/09/15 12:42:17 (woods)"
# XXX Maybe use of aliases should be mostly deprecated.... Their only real
# feature is that they automatically expand in front of any arguments that are
# also part of the command.
#
# Functions on the other hand are essentially portable.
#
# Converting aliases to functions can greatly simplify quoting, and any
# arguments can easily be passed with "$@", e.g.:
#
# rmdollar () { sed -e 's/\$//g' "$@"; }
#
# The "$@" just adds any arguments that you give to "rmdollar" when you use it.
if is_attksh; then
# in ATT Ksh there's a weird interaction between monitor mode and
# functions defined with the traditional fn(){} syntax such that when
# they are called at the end of a pipeline they are in their own process
# group and session and so there is no way to make an attachment the
# original tty via /dev/tty (at least on macos, but not on NetBSD),
# which means when an interactive command like a pager is started in
# such a function, and that function is called at the end of a pipeline,
# then it becomes impossible to interact with it! This doesn't happen
# with the aberrant Ksh "function fn{}" syntax, but aliases are an even
# easier workaround.
#
unset -f ds
alias ds='$PAGER'
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: 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 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 logout='exit 0'
alias maildate='LANG=c date "+%a, %d %b %Y %T %z"'
alias nosgr='echo '
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 rsyncbackup='rsync --info=stats3,flist,misc -a -H -E --numeric-ids'
alias scvs='export CVSROOT="$(< CVS/Root)"; echo "CVSROOT=$CVSROOT"'
alias snmpoidinfo='snmptranslate -T d -O f'
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'