Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Neither iwconfig nor iwlist seem to be able to do this for me.

share|improve this question
up vote 14 down vote accepted

Run nm-tool | grep \*. That should show just the line with the SSID you are connected to.

share|improve this answer
Thanks that's exactly what I needed. To get just the name:nm-tool |grep --only-matching '*[^ ][^:]*' |sed 's/^*//' – John Baber-Lucero Mar 29 '12 at 16:09
nmcli -t -f active,ssid dev wifi is easier to parse. The ssid is unfortunately encapsulated in some useless quotes though. – geirha Mar 29 '12 at 16:48
Or: nmcli -t -f active,ssid dev wifi | egrep '^yes' | cut -d\' -f2 (which will work as long as the SSID doesn't contain any ' characters) – Scott Severance Mar 30 '12 at 7:43

iwgetid provides the ssid

iwgetid -r gives just the name.

In a Bash script try something like myssid=$(iwgetid -r) to put it in a variable

share|improve this answer
Thanks! Looks much better than the commonly recommended iw/iwlan+sed/grep solutions. – Rob W Mar 19 '14 at 12:37

Although the question has already been answered, the iwconfig tool does display the ESSID of the currently connected Wifi network. Perhaps it does not work with connections managed through NetworkManager but it works with interfaces managed through ifup/ifdown:

iwconfig | grep wlan0


wlan0     IEEE 802.11bgn  ESSID:"ahoi"
share|improve this answer
Typing iwconfig only can do the purpose too :-) thanks for sharing this command :-) – Suhaib Mar 30 '13 at 18:22

You can also use the iw tool (from the iw package) to obtain the WiFi link parameters which includes the currently associated SSID - e.g for wlan0:

iw dev wlan0 link
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.