Skip to content

Instantly share code, notes, and snippets.

@MParvin
Last active February 21, 2026 10:16
Show Gist options
  • Select an option

  • Save MParvin/8314dad43e7ab22187aec3777cf1c89a to your computer and use it in GitHub Desktop.

Select an option

Save MParvin/8314dad43e7ab22187aec3777cf1c89a to your computer and use it in GitHub Desktop.
My Aliases and functions
alias zource='source ~/.zshrc'
alias vourse='source .venv/bin/activate'
# Wrong command as alias
alias sl='ls'
alias greo='grep'
# SSH key aliases
#alias myKey='cat ~/.ssh/id_ed25519.pub | xclip -selection c && echo "key copied to clipboard"'
alias myKey='cat ~/.ssh/id_ed25519.pub | /usr/bin/pbcopy && echo "key copied to clipboard"'
#alias myOldKey='cat ~/.ssh/id_rsa.pub | xclip -selection c && echo "key copied to clipboard"'
alias myOldKey='cat ~/.ssh/id_rsa.pub | /usr/bin/pbcopy && echo "key copied to clipboard"'
alias myKeyShow='cat ~/.ssh/id_ed25519.pub'
alias myKeyOldShow='cat ~/.ssh/id_rsa.pub'
# Dig aliases
alias d8='dig @8.8.8.8'
alias d8s='dig @8.8.8.8 +short'
alias d4s='dig @4.2.2.4 +short'
# CD aliases
alias MyGit='cd $MYGIT_DIR'
alias github='cd $MYGIT_DIR/github'
alias gitlab='cd $MYGIT_DIR/gitlab'
alias DastYar='cd $MYGIT_DIR/github/Bash/Dastyar'
# Ping aliases
alias p=ping
alias p8='ping 8.8.8.8'
alias p4='ping 4.2.2.4'
alias p1='ping 1.1.1.1'
alias p192='ping 192.168.1.1'
# Shecan aliases
alias shecan='echo -e "178.22.122.100\n185.51.200.2\n\n\nnameserver 178.22.122.100\nnameserver 185.51.200.2\n \n\nPro:\n\nnameserver 178.22.122.101\nnameserver 185.51.200.1\n"'
alias dshecan='dig @178.22.122.100 +short'
alias dshecan2='dig @185.51.200.2 +short'
alias dshecanpro='dig @178.22.122.101 +short'
alias dshecanpro2='dig @185.51.200.1 +short'
# Alias finder
alias al='alias | grep -i '
# Watch aliases
alias w1d='watch -n1 -d'
alias w3d='watch -n3 -d'
alias w1dk='watch -n1 -d kubectl'
# Kill ssh
alias pks='pkill ssh'
# VIM aliases
alias vizshrc='vim ~/.zshrc'
# Taskfile
alias ta='task'
# Terraform aliases
alias t='terraform'
# Docker aliases
alias dpu='noti docker pull'
alias dtag='docker tag'
alias dps='docker ps'
# Molecule
alias mol='molecule'
# Vagrant aliases
alias v='noti vagrant'
# Operator SDK
alias os='operator-sdk'
# Netstat aliases
alias netstat-mac='netstat -anp udp tcp'
alias nltp='netstat -nltp | grep '
# Kubectl aliases
alias k='kubectl'
alias kk='kubectl krew'
alias kctx='k ctx'
alias kns='k ns'
alias kl='kube-linter'
alias ing='kubectl get ingress -A | grep '
# Text browser
alias browsh='docker run --rm -it browsh/browsh'
# Find and notify
alias f='noti find'
# Docker compose
dcp() {
if docker compose version &>/dev/null; then
docker compose "$@"
else
docker-compose "$@"
fi
}
# vs code
alias c.='code .'
# ssc
alias ssc2ansible="awk \"{9print $2 \" \" \"ansible_host=\"$4 \" \" \"ansible_user=\"$6}\""
# Ansible
alias ap='ansible-playbook'
alias an='ansible'
# AI
alias ai='openai_pipe'
# Tools
alias tools='cd $MYGIT_DIR/tools'
# Clear DNS mac
alias flushdns='sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder'
# Brew
alias bi='brew install'
alias bs='brew search'
alias bin='brew info'
alias bis='brew install --cask'
# Shred
alias madshred='shred -n $(($RANDOM % 79 + 21))'
# sudo
alias s='sudo -i'
# tmux
alias tm='tmux at -t 0 || tmux'
# pip
alias pip=pip3
# zypper
alias zy=zypper
# Flatpak
alias fp='flatpak'
# Nmap
alias chesh='nmap -p22,80,443,3389,8080,9000,9100,9090 $1 --open -oN scan_result.txt'
# Functions
pc1() {
if [ -z "$1" ]; then
echo "Please enter a domain or IP address"
return 1
fi
# check if http or https is in the input
if [[ $1 == *"http"* ]]; then
ip_addr=$(echo $1 | cut -d '/' -f3)
else
ip_addr=$1
fi
ping -c1 $ip_addr
}
tel() {
# if -z $1 or $1 != *":"*
if [ -z "$1" ] || [[ $1 != *":"* ]]; then
echo "Please enter a url and port like this https://127.0.0.1:6443"
echo "Or just enter the IP address and port like this 127.0.0.1:6443"
return 1
fi
if [[ $1 == *"http"* ]]; then
ip_addr=$(echo $1 | cut -d '/' -f3 | cut -d ':' -f1)
port=$(echo $1 | cut -d '/' -f3 | cut -d ':' -f2)
else
ip_addr=$(echo $1 | cut -d ':' -f1)
port=$(echo $1 | cut -d ':' -f2)
fi
telnet $ip_addr $port
}
# Proxies
alias hiddy='export http_proxy=127.0.0.1:12334;export https_proxy=127.0.0.1:12334'
alias torry='export http_proxy=127.0.0.1:9050;export https_proxy=127.0.0.1:9050'
alias unproxy='unset http_proxy https_proxy'
# Python
alias pyv="compgen -c python | grep -E 'python[0-9]?\.[0-9]+$' | sort -u"
# Virtualenv function
ve() {
if [ $# -eq 0 ]
then
virtualenv .venv
vourse
return $?
fi
if [ "$1" == "-l" ]
then
pyv
return $?
fi
if [[ "$1" =~ ^[0-9]+(\.[0-9]+)?$ ]]
then
virtualenv .venv -p "python$1"
vourse
return $?
fi
pyv
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment