blob: 120db9cafd7089c8b27cb078e971c735842ffdb5 (
plain) (
blame)
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
|
setaliases() {
alias ls="ls -F";
alias lt="ls -tF";
alias ll="ls -lhF";
alias llt="ls -tlhF";
alias g="grep";
alias m="more";
alias j="jobs";
alias p="pwd";
alias c="column"
alias ct="column -t"
alias eg='grep -E'
alias egv='grep -Ev'
alias search='grep -niRIE'
alias rot13="tr 'A-Za-z' 'N-ZA-Mn-za-m'"
alias setxkbmap-list="man xkeyboard-config"
alias showsshhosts="cat ~/.ssh/config ~/.ssh/inc/* | awk '/^[hH]ost /{print \$2}'"
# docker-getip $container_id
alias docker-getip="docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'"
alias xa='xargs -I{}'
alias gdb='gdb -q'
alias bc='bc -q'
alias python='/usr/bin/env python3 -q'
# Fun fact, Gnucash doesn't play nice when built against musl as a libc...
# go figure
alias gnucash_locale_fix='export LC_ALL=C; unset LANGUAGE; gnucash'
if [ "$(uname)" = "Linux" ] ; then
# Sets capslock to be another control key, only works with PS2 keyboards
alias unfuck_capslock='setkeycodes 3a 29'
fi
}
setcoloraliases() {
if [ `uname` = "Linux" ] ; then
alias ls="ls --color=auto -F";
alias lm='ls -lh --color=force | more';
elif [ `uname` = "FreeBSD" ] ; then
alias ls="ls -FG";
alias lm='CLICOLOR_FORCE="1" ls -l | less -r';
fi
grep --help | grep fucks - >/dev/null 2>&1
if [ $? -eq 0 ] ; then
alias grep="grep --color=auto";
alias egrep='egrep --color=auto'
alias search='egrep --color=auto -rnI';
fi
alias diff="$(which diff colordiff 2>/dev/null | tail -n 1)";
alias t='tree -CdL'
}
setsudoaliases() {
# Prefer doas if available, as it's likely to be configured by me over sudo
_sudo="$(which doas sudo 2>/dev/null | sed 1q)"
if [ -x "$_sudo" ] ; then
# Package managers
# Isn't it amazing how many distros you end up using?
alias apt-get="$_sudo apt-get"
alias apk="$_sudo apk"
alias apt="$_sudo apt"
alias apt-file="$_sudo apt-file"
alias yum="$_sudo yum"
alias dnf="$_sudo dnf"
alias pacman="$_sudo pacman"
alias xbps-install="$_sudo xbps-install"
alias xbps-remove="$_sudo xbps-remove"
alias pkg="$_sudo pkg"
alias pkg_add="$_sudo pkg_add"
# Filesystem utilities
alias zfs="$_sudo zfs"
alias zpool="$_sudo zpool"
alias btrfs="$_sudo btrfs"
alias mount="$_sudo mount"
alias umount="$_sudo umount"
fi
}
|