iw means internet "wireless", so this is for wi-fi devices only. Like the "ip" command for ethernet connections, it isn't as robust and complete as networkManager (nmcli) but you can still do quite a bit. There are actually a couple of things the "iw" commands does do that networkManager doesn't do.
How to view your current wi-fi connection.
Note your wireless interface may not be named "wlan0". You can find out what it is called by running the "ip addr" command.
How to scan for available networks.
Warning, this command can return over 1500 lines of information, most of which you don't really care about.
This is one of the reasons, I prefer the nmcli command to do this, but this isn't about nmcli. Still, I recommend using that command
with "more" or something similar.
How to connect to a SSID.
example:
sudo iw dev wlan0 connect mywifihotspot.
Again, remember your wi-fi interface might not be named wlan0. One of mine is named wlp16s0 for example.
(they do almost always start with a "w").
How to disconnect from a wi-fi connection.
The following is NOT recommended unless you know what you're doing. But you can actually remove the wi-fi interface altogether.
I mentioned earlier, that iw could so something nmcli can't. iw is very good at teloling you what the hardware capabilities of your wi-fi device are.
Warning: This will return several hundred lines of information. But it will tell you what frequencies and channels your wi-fi device supports as well. Well, thse are the basics of the "iw" command. I will try to do more advanced settings soon.
How to view your current wi-fi connection.
Code:
iw dev wlan0 link
Note your wireless interface may not be named "wlan0". You can find out what it is called by running the "ip addr" command.
How to scan for available networks.
Code:
iw dev wlan0 scan
Warning, this command can return over 1500 lines of information, most of which you don't really care about.
This is one of the reasons, I prefer the nmcli command to do this, but this isn't about nmcli. Still, I recommend using that command
with "more" or something similar.
How to connect to a SSID.
Code:
sudo iw dev wlan0 connect <SSID>
example:
sudo iw dev wlan0 connect mywifihotspot.
Again, remember your wi-fi interface might not be named wlan0. One of mine is named wlp16s0 for example.
(they do almost always start with a "w").
How to disconnect from a wi-fi connection.
Code:
sudo iw dev wlan0 disconnect
The following is NOT recommended unless you know what you're doing. But you can actually remove the wi-fi interface altogether.
Code:
sudo iw dev wlan0 del
I mentioned earlier, that iw could so something nmcli can't. iw is very good at teloling you what the hardware capabilities of your wi-fi device are.
Code:
iw list
Warning: This will return several hundred lines of information. But it will tell you what frequencies and channels your wi-fi device supports as well. Well, thse are the basics of the "iw" command. I will try to do more advanced settings soon.

