Whenever I run into something I will be doing often enough I like to make an alias, a small function. or some configs. These threads are always fun and informative so I hope we all get to share and learn some new things. This is for zsh but should work for bash
# Disable Azure CLI Telemetry
export AZURE_CORE_COLLECT_TELEMETRY=false
# Disable .NET SDK Telemetry (used if you ever run az bicep or dotnet tools)
export DOTNET_CLI_TELEMETRY_OPTOUT=1
# Colorize man pages using LESS_TERMCAP
export LESS_TERMCAP_mb=$'\e[1;31m' # Start blinking (Bold Red)
export LESS_TERMCAP_md=$'\e[1;34m' # Start bold (Bold Blue – Headers)
export LESS_TERMCAP_me=$'\e[0m' # End all mode formatting
export LESS_TERMCAP_so=$'\e[01;33m' # Start stand-out (Yellow – Search highlights)
export LESS_TERMCAP_se=$'\e[0m' # End stand-out
export LESS_TERMCAP_us=$'\e[1;32m' # Start underline (Bold Green – Variables)
export LESS_TERMCAP_ue=$'\e[0m' # End underline
export GROFF_NO_SGR=1 # for konsole and gnome-terminal
alias reload="source ~/.zshrc"
alias myip='ip r | grep default'
# maps to to a command from trash-cli; will send to ~/.local/share/Trash instead
alias rm="trash-put"
## LOTS OF KUBERNETES ONES
# Cluster Routing Switchers
alias kcontext-MOTHERSHIP="kubectl config use-context default"
alias kcurr-context="kubectl config get-contexts"
# Global System Diagnostics
alias kinfo="kubectl cluster-info"
alias kver="kubectl version –client"
alias knodes="kubectl get nodes -o wide"
# Resource Lookups
alias kall-net="kubectl get all -n networking"
alias kpods="kubectl get pods -o wide"
alias ksvc="kubectl get svc –all-namespaces"
alias kingress="kubectl get ingress –all-namespaces"
# Real-Time Stream Tailing
alias klogs="kubectl logs -f –tail=100"
alias klogs-net="kubectl logs -f –tail=100 -n networking"
# Interactive Pod Shell Drop-In
alias kexec="kubectl exec -it"
alias kcontext-MOTHERSHIP="kubectl config use-context default"
alias kcurr-context="kubectl config get-contexts"
# Global System Diagnostics
alias kinfo="kubectl cluster-info"
alias kver="kubectl version –client"
alias knodes="kubectl get nodes -o wide"
alias khealth="kubectl get componentstatuses"
# Resource Lookups
alias kall-net="kubectl get all -n networking"
alias kpods="kubectl get pods -o wide"
alias kdeployments="kubectl get deployment"
alias ksvc="kubectl get svc –all-namespaces"
alias kingress="kubectl get ingress –all-namespaces"
# Ingress Controller Rules
alias kwhitelist="kubectl get configmap -n ingress-nginx-internal ingress-nginx-controller -o jsonpath='{.data.whitelist-source-range}'"
# Cluster Node Endpoint Extractors
alias kips="kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type == \"InternalIP\")].address}'"
alias kips-external="kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type == \"ExternalIP\")].address}'"
# Real-Time Stream Tailing
alias klogs="kubectl logs -f –tail=100"
alias klogs-net="kubectl logs -f –tail=100 -n networking"
# Interactive Pod Shell Drop-In
alias kexec="kubectl exec -it"
# Deployment Rollout Revisions Trace
alias krev-pihole="kubectl rollout history deployment/pihole-dns-server -n networking"
alias krev-tunnel="kubectl rollout history deployment/cloudflared-tunnel -n networking"
# Local Proxy Management
alias kproxy="kubectl proxy"
alias kkill="pkill -9 -f 'kubectl proxy'"
# Modern On-Demand Token Generator (Valid for 1 hour)
alias ktoken="kubectl -n kubernetes-dashboard create token admin-user"
# Inspect config-map value for a deployment
alias homepage-config="kubectl get configmap homepage-config -n networking -o yaml"
# GITHUB SHORTSCUTS
alias gswitch="git switch $1"
alias gmain="git switch main"
alias gprune="git fetch –prune"
// I know the echo is broken in hold()…
hold() {
echo "Holding for $1 minutes (PID $!)…"
systemd-inhibit –why="Running long task" –what=idle:sleep sleep "${1}m"
}
# Helper for adding torrents
add-media() {
deluge-console "add -p $HOME/Downloads/ 'magnet:?xt=urn:btih:$1'"
}
Source: r/linux · by /u/manny2206