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
| Argument | Description |
|---|---|
<index>... | Row number from the current listing, or @name for a mark; kx state or kx mark shows them |
Options
| Option | Description |
|---|---|
--kind | Print only the kind |
--name | Print only the resource name |
--namespace | Print only the namespace |
Global options
| Option | Description |
|---|---|
--no-color | Disable styled output |
-h, --help | Show 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)