134 lines
3.3 KiB
Bash
134 lines
3.3 KiB
Bash
# Aliases for APT
|
|
if [ -e "/etc/debian_version" ]; then
|
|
source /etc/os-release
|
|
if [ "$ID" = "debian" ]; then
|
|
alias acs='sudo apt-cache search -t "${VERSION_CODENAME}-backports"'
|
|
alias acp='sudo apt-cache policy -t "${VERSION_CODENAME}-backports"'
|
|
alias agu='sudo apt update -t "${VERSION_CODENAME}-backports"'
|
|
alias agud='sudo apt update -t "${VERSION_CODENAME}-backports" && sudo apt dist-upgrade -t "${VERSION_CODENAME}-backports"'
|
|
alias agi='sudo apt install -t "${VERSION_CODENAME}-backports"'
|
|
else
|
|
alias acs='sudo apt-cache search'
|
|
alias acp='sudo apt-cache policy'
|
|
alias agu='sudo apt update'
|
|
alias agud='sudo apt update && sudo apt dist-upgrade'
|
|
alias agi='sudo apt install'
|
|
fi
|
|
alias afs='sudo apt-file search'
|
|
alias afu='sudo apt-file update'
|
|
alias aac='sudo apt autoclean'
|
|
alias agc='sudo apt clean'
|
|
alias agli='sudo apt list --installed'
|
|
alias agp='sudo apt purge'
|
|
alias agr='sudo apt remove'
|
|
alias agar='sudo apt autoremove'
|
|
fi
|
|
|
|
# Aliases for DNF
|
|
if [ -e "/etc/redhat-release" ]; then
|
|
alias dnfc='sudo dnf clean all'
|
|
alias dnfgi='sudo dnf groupinstall'
|
|
alias dnfgl='dnf grouplist'
|
|
alias dnfgr='sudo dnf groupremove'
|
|
alias dnfi='sudo dnf install'
|
|
alias dnfl='dnf list'
|
|
alias dnfli='dnf list installed'
|
|
alias dnfmc='dnf makecache'
|
|
alias dnfp='dnf info'
|
|
alias dnfr='sudo dnf remove'
|
|
alias dnfs='dnf search'
|
|
alias dnfu='sudo dnf update'
|
|
fi
|
|
|
|
# The ls family
|
|
if test -x "$(command -v lsd)"; then
|
|
alias ls='lsd'
|
|
alias la='lsd -a'
|
|
alias ll='lsd -l'
|
|
alias lal='lsd -al'
|
|
else
|
|
alias ls='ls --color=auto'
|
|
alias la='ls -a'
|
|
alias ll='ls -l'
|
|
alias lal='ls -al'
|
|
fi
|
|
|
|
# grep
|
|
alias grep='grep --color'
|
|
|
|
# Prompt user before overwriting files
|
|
alias cp='cp -i'
|
|
alias mv='mv -i'
|
|
alias rm='rm -i'
|
|
|
|
# Display zsh functions with bat
|
|
alias zfun='functions | bat -l zsh'
|
|
|
|
# Use bat
|
|
if [ -f "$(command -v batcat)" ]; then
|
|
alias cat='batcat -p'
|
|
fi
|
|
|
|
if [ -f "$(command -v bat)" ]; then
|
|
alias cat='bat -p'
|
|
fi
|
|
|
|
# Assorted global aliases
|
|
alias -g H='| head'
|
|
alias -g T='| tail'
|
|
alias -g G='| grep'
|
|
alias -g L='| less -FRX'
|
|
alias -g B='| bat'
|
|
alias -g J='| jq'
|
|
alias -g CC='| wl-copy'
|
|
alias -g C='| wc -l'
|
|
|
|
# Get public IP address
|
|
alias pubip4='curl -s -m 5 ipv4.icanhazip.com'
|
|
alias pubip6='curl -s -m 5 ipv6.icanhazip.com'
|
|
|
|
# List apps with network connections
|
|
alias netcons='lsof -i'
|
|
|
|
# List ports
|
|
alias tulp='ss -tulp'
|
|
|
|
# List open ports
|
|
alias openports='sudo lsof -i | grep LISTEN'
|
|
|
|
# Ping google.com
|
|
alias pong='ping -c 3 www.google.com'
|
|
|
|
# Ping alias
|
|
alias ping='ping -c 3'
|
|
|
|
# List sockets in use
|
|
alias lsock='sudo lsof -i -P'
|
|
|
|
# List UDP sockets in use
|
|
alias lsocku='sudo lsof -nP | grep UDP'
|
|
|
|
# List TCP sockets in use
|
|
alias lsockt='sudo lsof -nP | grep TCP'
|
|
|
|
# firewalld
|
|
if test -x "$(command -v firewall-cmd)"; then
|
|
alias fw='sudo firewall-cmd'
|
|
alias fwp='sudo firewall-cmd --permanent'
|
|
alias fwr='sudo firewall-cmd --reload'
|
|
alias fwrp='sudo firewall-cmd --runtime-to-permanent'
|
|
fi
|
|
|
|
# git
|
|
alias ga='git add'
|
|
alias gcl='git clone'
|
|
alias gcmsg='git commit -m'
|
|
alias gd='git diff'
|
|
alias gl='git pull'
|
|
alias gp='git push'
|
|
alias gr='git remote'
|
|
alias grbi='git rebase -i'
|
|
alias grm='git rm'
|
|
alias grv='git remote -v'
|
|
alias gst='git status'
|