Created
October 6, 2025 16:10
-
-
Save teklynk/9247ed4b3c35052fae17d56df1ad7585 to your computer and use it in GitHub Desktop.
A Simple Bash Script to Toggle WiFi on and off - Linux Mint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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