How to list all MagicDNS hostnames?

Tailscale version: 1.2.8
Operating system & version: linux Ubuntu 20.04.1

Is there a way to list all MagicDNS hostnames? Preferably from command line.

Names listed by ‘tailscale status’ are the same names as the names in admin console, i.e. similar to host name but not same (e.g. my phone is listed as ‘Galaxy Note9’, the hostname is galaxy-note9). While it seems that one can guess how the host names are created (lowercase, replace dots and spaces by dashes) it would be nice to have actual names listed somewhere.

The machine details in console are not very convenient because they need to be looked up one by one (and require to go to console instead of being available on command line) but are also not perfect, if I copy and paste the name from console (staying with my phone example), e.g. I get not found. However just galaxy-note9 or full name both work (but those I cannot find anywhere in that form).


$ tailscale status -json | jq -r '.Peer[].DNSName' | grep . 
1 Like

Thanks! That’s pretty cool, I missed the -json option.