Skip to content

Instantly share code, notes, and snippets.

@teklynk
Created October 6, 2025 16:10
Show Gist options
  • Select an option

  • Save teklynk/9247ed4b3c35052fae17d56df1ad7585 to your computer and use it in GitHub Desktop.

Select an option

Save teklynk/9247ed4b3c35052fae17d56df1ad7585 to your computer and use it in GitHub Desktop.
A Simple Bash Script to Toggle WiFi on and off - Linux Mint
#!/bin/bash
# Check the current status of WiFi using nmcli
status=$(nmcli -t -f WIFI g)
if [ "$status" = "enabled" ]; then
# WiFi is currently on, so turn it off
echo "Turning WiFi off..."
nmcli radio wifi off
play /usr/share/mint-artwork/sounds/unplug.oga
notify-send "Turning WiFi off..."
else
# WiFi is currently off, so turn it on
echo "Turning WiFi on..."
nmcli radio wifi on
play /usr/share/mint-artwork/sounds/plug.oga
notify-send "Turning WiFi on..."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment