Files
opalfiles/.config/zsh/zsh_aliases
2022-12-11 00:38:06 -08:00

131 lines
4.1 KiB
Plaintext

#######################################################
# ALIAS
#######################################################
# To temporarily bypass an alias, we preceed the command with a \
# EG: the ls command is aliased, but to use the normal ls command you would type \ls
# Source zsh
alias zshrcsource="source ~/.config/zsh/.zshrc"
# Pacman aliases
alias install='sudo pacman -S'
alias update='sudo pacman -Syu'
alias search='pacman -Ss'
alias remove='sudo pacman -Rs'
alias uninstall='sudo pacman -Rs'
# ip
alias ip="ip -c"
# Rsync push music to jellyfin
alias music-push="rsync -r -e 'ssh -p 46668' --info=progress2 /home/opal/music/to-push/* cleric:/data/container_storage/jellyfin/media/music/to-sort/"
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# alias to show the date
alias da='date "+%Y-%m-%d %A %T %Z"'
# Alias's to modified commands
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -iv'
alias mkdir='mkdir -p'
alias ps='ps auxf'
alias ping='ping -c 10'
alias less='less -R'
alias vi='vim'
alias vis='vim "+set si"'
# Change directory aliases
alias home='cd ~'
alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
# cd into the old directory
alias bd='cd "$OLDPWD"'
# Alias's for multiple directory listing commands
alias la='ls -Alh' # show hidden files
alias ls='ls -aFh --color=always' # add colors and file type extensions
alias lx='ls -lXBh' # sort by extension
alias lk='ls -lSrh' # sort by size
alias lc='ls -lcrh' # sort by change time
alias lu='ls -lurh' # sort by access time
alias lr='ls -lRh' # recursive ls
alias lt='ls -ltrh' # sort by date
alias lm='ls -alh |more' # pipe through 'more'
alias lw='ls -xAh' # wide listing format
alias ll='ls -Fls' # long listing format
alias labc='ls -lap' #alphabetical sort
alias ldir="ls -l | egrep '^d'" # directories only
# Search command line history
alias h="history | grep "
# Search files in the current folder
alias f="find . | grep "
# Count all files (recursively) in the current folder
alias countfiles="for t in files links directories; do echo \`find . -type \${t:0:1} | wc -l\` \$t; done 2> /dev/null"
# Show current network connections to the server
alias ipview="netstat -anpl | grep :80 | awk {'print \$5'} | cut -d\":\" -f1 | sort | uniq -c | sort -n | sed -e 's/^ *//' -e 's/ *\$//'"
# Show open ports
alias openports='netstat -nape --inet'
# Alias's to show disk space and space used in a folder
alias diskspace="du -S | sort -n -r |more"
alias folders='du -h --max-depth=1'
alias folderssort='find . -maxdepth 1 -type d -print0 | xargs -0 du -sk | sort -rn'
alias tree='tree -CAhF --dirsfirst'
alias treed='tree -CAFd'
alias mountedinfo='df -hT'
# Alias's for archives
alias mktar='tar -cvf'
alias mkbz2='tar -cvjf'
alias mkgz='tar -cvzf'
alias untar='tar -xvf'
alias unbz2='tar -xvjf'
alias ungz='tar -xvzf'
# Show all logs in /var/log
alias logs="sudo find /var/log -type f -exec file {} \; | grep 'text' | cut -d' ' -f1 | sed -e's/:$//g' | grep -v '[0-9]$' | xargs tail -f"
# SHA1
alias sha1='openssl sha1'
# Wireguard
alias wgup='sudo wg-quick up /etc/wireguard/wg0.conf'
alias wgdown='sudo wg-quick down /etc/wireguard/wg0.conf'
# Hugo
alias hss='hugo server --noHTTPCache'
# Work
alias stork='ssh stork'
alias mail='ssh mail'
alias eel='ssh eel'
# Wget (keeps hsts files out of $HOME)
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
# vim -> neovim (cuz nvim > vim)
alias vim='nvim'
# Ansible
alias ans-run="ansible-playbook site.yml --ask-become-pass"
alias ans-run-tag="ansible-playbook site.yml --ask-become-pass --tags"
alias ans-run-start="ansible-playbook site.yml --ask-become-pass --start-at-task"
# Misc
alias music-push="rsync -e 'ssh -p 46668' --info=progress2 -r /home/opal/music/to-push/ cleric:/data/container_storage/jellyfin/media/music/to-sort/"