Skip to content

Instantly share code, notes, and snippets.

@sathishvj
Last active February 9, 2018 04:15
Show Gist options
  • Save sathishvj/87ac391577727fcd3add3da570db39da to your computer and use it in GitHub Desktop.
Save sathishvj/87ac391577727fcd3add3da570db39da to your computer and use it in GitHub Desktop.
Toggle Mac/OSX wifi from command line
# add this to your .profile or .bashrc or other.
alias wifitoggle='echo -n "Previous status: " && networksetup -getairportpower en0 | grep "Wi-Fi"; networksetup -getairportpower en0 | grep -q "On" && networksetup -setairportpower en0 off || networksetup -setairportpower en0 on; echo -n "New status: " && networksetup -getairportpower en0 | grep "Wi-Fi"; '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment