How can I find Wi-Fi SSID using a terminal command?
How can I find the SSID from the wifi with a cmd in the terminal
[Re-Titled by Moderator]
iMac 24″, macOS 14.6
How can I find the SSID from the wifi with a cmd in the terminal
[Re-Titled by Moderator]
iMac 24″, macOS 14.6
The following works on my Sequoia v15.3 system to output the SSID using the Zsh shell. It gets a sorted list of the en0 - en9 interfaces and performs an ipconfig getsummary on each. Finally, it finds the SSID (that leading space is deliberate) string in the getsummary output and prints it. Failed matches are discarded to dev/null.
for i in ${(o)$(ifconfig -lX "en[0-9]")};do ipconfig getsummary ${i} | awk '/ SSID/ {print $NF}';done 2> /dev/null
The wdutil info output shows <redacted> for both SSID and BSSID on my system. I am using WPA3 security and that may have something to do with the redaction.
A Zsh script that will also work (once made executable) if one's shell is Bash follows:
#!/bin/zsh
for i in ${(o)$(ifconfig -lX "en[0-9]")};
do
ipconfig getsummary ${i} | awk '/ SSID/ {print $NF}'
done 2> /dev/null
exit 0
Hello. Have you tried using wdutil?
usage: sudo wdutil diagnose [-q] [-f outputDirectoryPath]
-q may be specified to suppress legal prompt and Finder window
sudo wdutil info
sudo wdutil log [{+|-} {system|wifi}]+
sudo wdutil dump
sudo wdutil clean
Hi,
SSID stands for "Service Set IDentifier" and is your Wi-Fi network name.
You can see it following commands in the Terminal.app.
networksetup -listallhardwareports | awk '/Wi-Fi/{getline; print $2}' | xargs networksetup -getairportnetwork
kaz-k wrote:
You can see it following commands in the Terminal.app.
networksetup -listallhardwareports | awk '/Wi-Fi/{getline; print $2}' | xargs networksetup -getairportnetwork
What I get…
dialabrain@iMac-M3 ~ % networksetup -listallhardwareports | awk '/Wi-Fi/{getline; print $2}' | xargs networksetup -getairportnetwork
You are not associated with an AirPort network.
The following works on my Sequoia v15.3 system to output the SSID using the Zsh shell. It gets a sorted list of the en0 - en9 interfaces and performs an ipconfig getsummary on each. Finally, it finds the SSID (that leading space is deliberate) string in the getsummary output and prints it. Failed matches are discarded to dev/null.
for i in ${(o)$(ifconfig -lX "en[0-9]")};do ipconfig getsummary ${i} | awk '/ SSID/ {print $NF}';done 2> /dev/null
The wdutil info output shows <redacted> for both SSID and BSSID on my system. I am using WPA3 security and that may have something to do with the redaction.
A Zsh script that will also work (once made executable) if one's shell is Bash follows:
#!/bin/zsh
for i in ${(o)$(ifconfig -lX "en[0-9]")};
do
ipconfig getsummary ${i} | awk '/ SSID/ {print $NF}'
done 2> /dev/null
exit 0
FWIW, your command does work for me. What I don't understand is the need to use a Terminal command when the info is right in System Settings > Wi-Fi. 🤔
To create a script.
dialabrain wrote:
FWIW, your command does work for me. What I don't understand is the need to use a Terminal command when the info is right in System Settings > Wi-Fi. 🤔
I just complied with the original request that asked for a Terminal solution to find the SSID name.
Yes, I know. :)
How can I find Wi-Fi SSID using a terminal command?