2023-09-15 22:59:26 +02:00
|
|
|
# Get top 10 shell commands
|
|
|
|
alias top10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
|
|
|
|
|
|
|
|
# history mechanism
|
|
|
|
alias h='history'
|
|
|
|
|
|
|
|
# Aliases for APT
|
|
|
|
if [ -e "/etc/debian_version" ]; then
|
|
|
|
alias acs="sudo apt-cache search"
|
|
|
|
alias acp="sudo apt-cache policy"
|
|
|
|
alias afs="sudo apt-file search"
|
|
|
|
alias afu="sudo apt-file update"
|
|
|
|
alias aac="sudo apt autoclean"
|
|
|
|
alias agc="sudo apt clean"
|
|
|
|
alias agi="sudo apt install"
|
|
|
|
alias agli="sudo apt list --installed"
|
|
|
|
alias agp="sudo apt purge"
|
|
|
|
alias agr="sudo apt remove"
|
|
|
|
alias agu="sudo apt update"
|
|
|
|
alias agud="sudo apt update && sudo apt dist-upgrade"
|
|
|
|
alias agar="sudo apt autoremove"
|
|
|
|
fi
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
# Convert UPPER to lower (or back)
|
|
|
|
alias UP2low='for i in *(.); mv $i ${i:l}'
|
|
|
|
alias low2UP='for i in *(.); mv $i ${i:u}'
|
|
|
|
|
|
|
|
# The ls family
|
2024-02-01 18:34:16 +01:00
|
|
|
if test -x "$(command -v lsd)"; then
|
|
|
|
alias ls='lsd'
|
2023-09-15 22:59:26 +02:00
|
|
|
else
|
|
|
|
alias ls='ls --color=auto'
|
|
|
|
fi
|
|
|
|
|
|
|
|
alias l='ls -lFhg'
|
|
|
|
alias la='ls -a'
|
|
|
|
alias ll='ls -l'
|
|
|
|
alias lal='ls -al'
|
|
|
|
alias ldot='ls -gld .*'
|
2024-02-01 18:34:16 +01:00
|
|
|
alias lse='ls -lZ'
|
2023-09-15 22:59:26 +02:00
|
|
|
|
|
|
|
# greps
|
|
|
|
alias grep='grep --color'
|
|
|
|
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}'
|
|
|
|
|
|
|
|
# Copy SSH public key to clipboard (requires xclip or xsel)
|
|
|
|
if test -x "$(command -v xclip)"; then
|
|
|
|
alias pubkey='printf "$(cat ~/.ssh/id_ed25519.pub)" | xclip -selection clipboard | echo "SSH public key copied"'
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Prompt user before overwriting files
|
|
|
|
alias cp='cp -i'
|
|
|
|
alias mv='mv -i'
|
|
|
|
alias rm='trash'
|
2024-02-01 18:34:16 +01:00
|
|
|
alias del='/bin/rm -i'
|
2023-09-15 22:59:26 +02:00
|
|
|
|
|
|
|
# Display zsh functions with bat
|
|
|
|
alias zfun='functions | bat -l zsh'
|
|
|
|
|
|
|
|
# Assorted global aliases
|
|
|
|
alias -g H='| head'
|
|
|
|
alias -g T='| tail'
|
|
|
|
alias -g G='| grep'
|
|
|
|
alias -g L='| less -X'
|
|
|
|
alias -g B='| bat'
|
|
|
|
alias -g J='| jq'
|
|
|
|
alias -g CC='| xclip -selection clipboard'
|
|
|
|
alias -g C='| wc -l'
|
|
|
|
|
|
|
|
# Get public IP address
|
2024-08-04 06:34:48 +02:00
|
|
|
alias pubip4='curl -s -m 5 ipv4.icanhazip.com'
|
|
|
|
alias pubip6='curl -s -m 5 ipv6.icanhazip.com'
|
2023-09-15 22:59:26 +02:00
|
|
|
|
|
|
|
# List apps with network connections
|
2024-02-01 18:34:16 +01:00
|
|
|
alias netcons='lsof -i'
|
2023-09-15 22:59:26 +02:00
|
|
|
|
|
|
|
# List ports
|
|
|
|
alias tulp='ss -tulp'
|
|
|
|
|
|
|
|
# List open ports
|
2024-02-01 18:34:16 +01:00
|
|
|
alias openports='sudo lsof -i | grep LISTEN'
|
2023-09-15 22:59:26 +02:00
|
|
|
|
|
|
|
# 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
|
2024-02-01 18:34:16 +01:00
|
|
|
alias lsocku='sudo lsof -nP | grep UDP'
|
2023-09-15 22:59:26 +02:00
|
|
|
|
|
|
|
# List TCP sockets in use
|
2024-02-01 18:34:16 +01:00
|
|
|
alias lsockt='sudo lsof -nP | grep TCP'
|
2023-09-15 22:59:26 +02:00
|
|
|
|
|
|
|
# Reboot / Poweroff
|
|
|
|
alias rbt='sudo systemctl reboot'
|
|
|
|
alias shut='sudo systemctl poweroff'
|
|
|
|
|
|
|
|
# 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'
|
|
|
|
|
|
|
|
# doom emacs
|
|
|
|
alias doomdoc="~/.config/emacs/bin/doom doctor"
|
|
|
|
alias dsync="~/.config/emacs/bin/doom sync"
|
|
|
|
alias dclean="~/.config/emacs/bin/doom clean"
|
|
|
|
alias dcomp="~/.config/emacs/bin/doom compile"
|
|
|
|
alias dpurge="~/.config/emacs/bin/doom purge"
|
|
|
|
alias denv="~/.config/emacs/bin/doom env"
|
|
|
|
alias dupgrade="~/.config/emacs/bin/doom upgrade"
|