With nmcli
you could list all devices and their type e.g.
nmcli --get-values GENERAL.DEVICE,GENERAL.TYPE device show
eno1
ethernet
wlp1s0
wifi
wlp1s1
wifi
p2p-dev-wlp1s0
wifi-p2p
lo
loopback
Per the manual, when using -g, --get-values
, the "output is terse. This mode is designed and suitable for computer (script) processing". So you can pipe that output to other tools and get the wifi devices names e.g.
nmcli ... | sed '/^wifi/!{h;d;};x'
or
nmcli ... | awk '/^wifi/{print dev; next};{dev=$0};'
On linux you also have iw
(show/manipulate wireless devices and their configuration) and when used with the dev
command:
Commands:
dev
List all network interfaces for wireless hardware.
that is
iw dev
you'll get something like:
phy#0
Interface wlan0
ifindex 3
wdev 0x1
addr 00:12:32:e4:18:24
type managed
phy#1
Interface wlan1
ifindex 4
wdev 0x2
addr 00:12:22:c6:b2:0a
type managed
To extract only interfaces names you could process the output e.g.
iw dev | awk '$1=="Interface"{print $2}'
just keep in mind the help page clearly states:
Do NOT screenscrape this tool, we don't consider its output stable.