Skip to content

Cheat Sheets

Mike Wheway edited this page May 7, 2026 · 7 revisions

This is a quick cheat sheet for common commands/scripts that you may use in your day-to-day travels.

git

  • git fetch --prune - Prunes remote branches that no longer exist on the server (Does not remove your local branch)
  • git branch -vv | awk '/: gone]/ {print $1}' | xargs git branch -D - Delete all local branches whose remotes have been pruned

bash

  • watch -n 10 'ps -o pid,etime,stat,cmd -p PID' - Same as running ps aux PID every 10 seconds, useful to watch for when a process completes. You can put multiple PIDs by separating them with a space.

vi

  • dd - delete current line
  • i — enter insert mode at cursor position
  • o — enter insert mode on a new line below the current line (this is what you want)
  • Escape — go back to normal mode
  • hjkl — move left/down/up/right in normal mode (or just use arrow keys)
  • :wq — save and quit (type this in normal mode)
  • :q! — quit without saving if you've made a mess

Traefik

Test Traefik router/service without browser

curl -k --resolve "sub.example.com:443:192.168.1.100" https://sub.example.com

Kubernetes

Delete all PVCs with the StorageClass nfs-multimedia or nfs-backups in a namespace

kubectl get pvc -n NAMESPACE --no-headers | awk '$6 == "nfs-multimedia" || $6 == "nfs-backups" {print $1}' | xargs kubectl delete pvc -n NAMESPACE 

Remove fiinalizers on all PVCs with StorageClass nfs-multimedia or nfs-backups in a namespace:

kubectl get pvc -n NAMESPACE --no-headers | awk '$6 == "nfs-multimedia" || $6 == "nfs-backups" {print $1}' | xargs -I{} kubectl patch pvc {} -n NAMESPACE  -p '{"metadata":{"finalizers":null}}'

Delete a single pvc:

kubectl delete pvc RESOURCE_NAME -n NAMESPACE 

Remove Finalizer from a single resource (Change pvc to the actual resource kind):

kubectl patch pvc RESOURCE_NAME -n NAMESPACE -p '{"metadata":{"finalizers":null}}'

Copy files from a folder on the host to a pod:

kubectl cp /path/to/local/folder/. namespace/podname:/path/in/pod/

Rolling restart on a deployment (Necessary after ConfigMap changes)

kubectl rollout restart deployment/APPNAME -n NAMESPACE

View the status of a rolling restart on a deployment (This command will hold the thread until everything is up and running)

kubectl rollout status deployment/APPNAME -n NAMESPACE

ArgoCD

Login:

argocd login DOMAIN.COM

Sync an app:

argocd app sync APP_NAME 

Refresh a single app:

argocd app get APP_NAME --refresh

Refresh all apps

argocd app list -o name | xargs -I {} argocd app get {} --refresh

Clone this wiki locally