diff --git a/bash/.aliases b/bash/.aliases index 5c185df..1266c6e 100644 --- a/bash/.aliases +++ b/bash/.aliases @@ -1,15 +1,15 @@ # Custom Bash Aliases -## system services +# system services alias restart="sudo systemctl restart" alias status="sudo systemctl status" -## navigation +# navigation alias ..='cd ..' alias ...='cd ../../' alias ....='cd ../../../' -## system information +# system information alias connections="sudo netstat -tunlp" alias ports='netstat -tulanp' alias path='echo -e ${PATH//:/\\n}' @@ -17,39 +17,44 @@ alias free='free -m -l -t' alias psmem='ps auxf | sort -nr -k 4 | head -10' alias pscpu='ps auxf | sort -nr -k 3 | head -10' -## system logs +# system logs alias logtail="tail -n 200 /var/log/syslog" -## system administration +# system administration alias upgrade="sudo apt update && sudo apt upgrade -y" alias syscat='systemctl cat' alias sysls='systemctl list-unit-files --type=service --state=enabled' alias syslsa='systemctl list-unit-files --type=service' -## safe defaults +# safe defaults alias rm='rm -I --preserve-root' alias chown='chown --preserve-root' alias chmod='chmod --preserve-root' alias chgrp='chgrp --preserve-root' -## apps +# alias `git` and add completion alias g='git' # enable tab completion for 'g' by marking as alias for 'git' if type _git &> /dev/null; then complete -o default -o nospace -F _git g; fi -alias bat='batcat' +# bat[cat] setup -- check for command name and alias accordingly +if command -q batcat; and not command -q bat + alias bat='batcat' +end + +# use `bat` for help command (override bash built-in) alias bathelp='bat --plain --language=help' help() { "$@" --help 2>&1 | bathelp } -## text editing +# text editing alias edit="emacs" alias sedit="sudo emacs" -## ls helpers +# ls helpers alias l="ls -lFh --color" alias la="ls -AF --color" # exclude . and .. alias lsd="ls -lFh --color | grep --color=never '^d'" # only directories @@ -61,7 +66,7 @@ alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' -## misc utils +# misc utils alias ip="dig +short myip.opendns.com @resolver1.opendns.com" alias ping='ping -c 5' alias reload="exec ${SHELL} -l" # reload the shell