Submitted by abitowhit on Mon, 08/06/2018 - 16:15
Two simple shell scripts to turn wifi on or off.
At one point I was just clicking on desktop links to these but eventually found it was easier to do it from the task bar.
They simply run iwconfig to flip txpower on the wlan wifi adapter.
wifiOff.sh
sudo iwconfig wlan0 txpower off
echo "Wifi is Off"
iwconfig
sleep 10
wifiOn.sh
sudo iwconfig wlan0 txpower auto
echo "Wifi is Off"
iwconfig
sleep 10
If you run iwconfig without arguments, it will tell you what your wifi looks like
wlan0 IEEE 802.11 ESSID:"YOUR-WIFI-ROUTER-ID"
Mode:Managed Frequency:2.462 GHz Access Point: ##:##:##:##
Bit Rate=72.2 Mb/s Tx-Power=31 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=45/70 Signal level=-65 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:3 Invalid misc:0 Missed beacon:0
eth0 no wireless extensions.
lo no wireless extensions.