diff options
Diffstat (limited to 'shell/aliases')
| -rw-r--r-- | shell/aliases | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/shell/aliases b/shell/aliases new file mode 100644 index 0000000..a734227 --- /dev/null +++ b/shell/aliases @@ -0,0 +1,79 @@ +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 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 +} + |
