Skip to content

Instantly share code, notes, and snippets.

@vanenshi
Last active November 5, 2021 17:36
Show Gist options
  • Save vanenshi/a8d454e2612b2599707c962067abd3a9 to your computer and use it in GitHub Desktop.
Save vanenshi/a8d454e2612b2599707c962067abd3a9 to your computer and use it in GitHub Desktop.
toggle VPN connection bash script
#!/bin/sh
VPN_NAME="<Your-VPN-Connection-NAME>"
if nmcli connection show --active | grep "$VPN_NAME"
then
nmcli connection down id "$VPN_NAME"
else
nmcli connection up id "$VPN_NAME"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment