Skip to content

kx ref

Prints the resource an index refers to as a kubectl argument fragment, one line per index, so an index can be spent on anything — a kubectl verb kx doesn’t wrap, or another tool entirely.

--name, --namespace and --kind print that field alone, for tools that take the pieces separately. They are mutually exclusive: one field per line means a caller always knows how many words a line holds.

Nothing here touches the cluster. It reports what the index means, not what still exists — the command you spend it on is what finds out.

Usage

kx ref [OPTIONS] <index>...

Arguments

ArgumentDescription
<index>...Row number from the current listing, or @name for a mark; kx state or kx mark shows them

Options

OptionDescription
--kindPrint only the kind
--namePrint only the resource name
--namespacePrint only the namespace

Global options

OptionDescription
--no-colorDisable styled output
-h, --helpShow this message and exit

Examples

kx ref 3
kubectl exec $(kx ref 3) -- sh
kubectl get $(kx ref 1..3)
stern $(kx ref 3 --name) -n $(kx ref 3 --namespace)