Search code examples
linuxshellsecuritycommandwifi

get info from nmcli linux shell script


I am making a script in shell and I want to extract information from the command nmcli.

If I execute nmcli -p dev wifi list in a linux terminal I get a table with all Wi-Fi available. From each Wi-Fi (SSID) in the table I want to get only the SECURITY field.

So the output of the script would be something like:

SSID1 : SSID1-SECURITY

SSID2 : SSID2-SECURITY

...   :  ...

I've been searching for a while but haven't found how to do it :(

Can someone tell me how to get the security field from each SSID?

Thank you very much.


Solution

  • Don't know much about nmcli, but I think you can do :

    nmcli -p dev wifi list | grep 'SSID.*SECURITY'