how to list tailscale devices from the cli?

257 views Asked by At

I am a recent tailscale user. I am trying to ssh between devices in my tailnet - but I do not want to continuously check device names in my tailscale dashboard. Is there any way to list tailnet devices with the cli?

Thanks!

1

There are 1 answers

2
DazWilkin On BEST ANSWER

Does tailscale status address your need?

If not, you can generate an API key from Keys and then use the API:

And grab your Organization from General

BASE_URL="https://api.tailscale.com/api/v2"

TAILNET="" # Replace with Organization
TOKEN=""   # Replace with API Key

curl \
--silent \
--location \
--get \
--header "Authorization: Bearer ${TOKEN}" \
${BASE_URL}/tailnet/${TAILNET}/devices \
| jq -r .devices[].name