Since my laptop doesnt have a Wireless Network LED indicator, I want to know if there is a command to verify if it is on or off (I'm installing the wireless drivers, so I can't tell if it is set on or off by seeing the list of wireless conections next to the clock)
8 Answers
Edit:
nmcli
changed a lot (I am using 16.04) from its previous version. See the original answer below.
To see the connectivity status
$ nmcli general status
STATE CONNECTIVITY WIFI-HW WIFI WWAN-HW WWAN
connected full enabled enabled enabled enabled
To see only wifi status
$ nmcli radio wifi
enabled
To see the active connection
$ nmcli connection show --active
NAME UUID TYPE DEVICE
VolCSe 5u6h4521-7k1p-20r3-3g4x-fg19his0j3s8 802-11-wireless wlp2s0
There are some nice addlitions like, to get the available wifi network informations,
$ nmcli device wifi
* SSID MODE CHAN RATE SIGNAL BARS SECURITY
* VolCSe Infra 1 54 Mbit/s 73 ▂▄▆_ WPA2
Sach Infra 4 54 Mbit/s 55 ▂▄__ WPA1 WPA2
iKCP Infra 5 54 Mbit/s 24 ▂___ WPA2
TP-LINK_POCKET_3 Infra 1 54 Mbit/s 12 ▂___ WPA1 WPA2
Note: I have used fictitious ssid and uuid info above.
Old answer:
You can use nmcli
for this purpose. Open a terminal type in terminal,
nmcli nm
You will have output like,
RUNNING STATE WIFI-HARDWARE WIFI WWAN-HARDWARE WWAN
running connected disabled disabled enabled disabled
See the third and fourth column which contains information of your interest.
If you want to be more specific only to wifi, then try in terminal,
nmcli nm wifi
it will show the wifi status only,
WIFI
disabled
rfkill list
This wil show devices that are either software or hardware blocked. In my case it's not blocked and wifi is on:
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
When the driver is up and running, the wireless interface should show up in the list when using the following command:
ifconfig

- 84
- 3
-
For me, it shows
Soft blocked: no
even if my WiFi is turned off (although hardware is enabled). – nsane Jan 01 '14 at 17:29
As of 15.04 (and later, including 16.04 LTS), the nmcli command has changed. There, you'll use:
⟫ nmcli radio
WIFI-HW WIFI WWAN-HW WWAN
enabled enabled enabled enabled
or just
⟫ nmcli radio wifi
enabled

- 14,608
In my case, i used below commands and the output was 1 if the wifi was enabled else 0. You can try and good luck.
nmcli r wifi | grep enabled | grep -v not | wc -l

- 31
- 1
-
this still works in 2024 (tested on Debian 12), but what does
r
mean? I scrolled through all of theman nmcli
and I don't see such a command. – Violet Giraffe Feb 12 '24 at 12:44
You can use WICD. if it not installed, then just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
sudo apt-get install wicd-gtk
Once installed, run it to see connectivity, Access point connected to, properties, IP settings, and much more.

- 107,631
-
it only shows the eth0 since the wlan0 isn't 'installed' yet – Raphael Fernandes Jan 01 '14 at 18:33
-
-
-
The question asks how to check connectivity from terminal. Your answer involves using a GUI. – thebunnyrules May 11 '18 at 03:22
In addition to the cli commands listed here there is a cli utility called: nmtui (more info here: https://www.unixarena.com/2015/04/rhel-7-network-management-nmcli-or-nmtui.html )
It has all the convenience of a GUI while being 100% cli (meaning you don't actually need a DE or WM to run it and you can run it out of the tty).

- 1,083
- 1
- 13
- 20
One can use ip address
or ip addr
command instead of slightly old ifconfig
. If you know the name of your interface device, you can use ip addr show <device name>
. Here's an example ( notice state UP
part, which for disabled interface shows up as DOWN
):
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether d0:53:49:3d:53:fd brd ff:ff:ff:ff:ff:ff
inet 192.168.0.2/24 brd 192.168.0.255 scope global dynamic wlan7
valid_lft 86183sec preferred_lft 86183sec
inet6 fe80::439:869d:d6ed:c983/64 scope link
valid_lft forever preferred_lft forever

- 105,154
- 20
- 279
- 497
nmcli nm wifi on
to enable andnmcli nm wifi off
to disable – sourav c. Jan 01 '14 at 18:37WIFI unknown
. I could usesudo rfkill block wifi
andsudo rfkill unblock wifi
instead, as described here. Note that my computer is quite old, so it might be that thenetwork-manager
did not recognize my hardware. Also, the OS is Ubuntu 12.04. – Krøllebølle Apr 17 '15 at 16:26