Skip to content

Instantly share code, notes, and snippets.

@jk
Created June 12, 2024 08:53
Show Gist options
  • Save jk/ebd7f60561b9543378cc20fb4bfd02c9 to your computer and use it in GitHub Desktop.
Save jk/ebd7f60561b9543378cc20fb4bfd02c9 to your computer and use it in GitHub Desktop.
Get a sorted list of kubectl get shortnames
kubectl api-resources --no-headers | awk -F' ' '{if (NF == 5) {shortname=$2; name=$1; kind=$5} else if (NF == 4) {shortname=""; name=$1; kind=$4} else {shortname=$2; name=$1; kind=$4} if (shortname != "") print shortname "\t" name "\t" kind}' | sort | uniq | column -t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment