Skip to content

Instantly share code, notes, and snippets.

@sagarrakshe
Last active October 8, 2015 03:29
Show Gist options
  • Save sagarrakshe/3270877 to your computer and use it in GitHub Desktop.
Save sagarrakshe/3270877 to your computer and use it in GitHub Desktop.
Build your own command to connect/disconnect to mobile broadband.
nmcli - is a command tool for controlling Network Manager.
1. Create a file called Internet-up.
2. Copy the following line in it
lsusb | (grep -i <string identifying your mobile> &) && (nmcli con up id "<your connection name>" ) && ((ps -el | grep -i firefox ) || firefox &)
[eg. lsusb | (grep -i nokia &) && (nmcli con up id "Idea Mobile" ) && ((ps -el | grep -i firefox ) || firefox &)]
(Note: ignore '<' but not '"' connection name should be in "qoutes".)
3. Using chmod make it executable (chmod 777 all permissions to everyone).
4. Now copy the file to one the Shell PATH (you can see the path by executing the command "echo $PATH") or you can add your own path to .bashrc.
5. Now just execute it.
For Internet-down file everything is same except copy the following line in the file.
nmcli con down id "<your connection name>"
(Note: This works only when you have connected your mobile through USB and configured it.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment