Most Linux distros with modern desktop environments come with GUI to manage the network connections. You can easily connect and disconnect to/from mobile broadband using the GUI. Usually in GNOME or in it’s forks, nm-applet comes pre-installed. nm-applet is used for network managements. But if you prefer the command line, or wish to do things in different ways, then connecting and disconnecting mobile broadband from the command line using the terminal may interest you. Well, at least I felt interested enough to try it.
nm-applet comes with nmcli which gives you the option to manage the network connections from the command line. Do execute man nmcli in terminal to know more about this nmcli command.
- First, execute the following command to know about the device name and perhaps of it’s UUID.
nmcli con list
This will show you the available connection name, uuid and types. Your mobile broadband modem maybe of gsm type. That’s one way of identifying your modem. Now, to connect or disconnect your modem, you can either use the name or the UUID.
- Use the following format to connect to the internet using mobile broadband:
nmcli con up id 'your_modems_name'
For example, my modem has been identified as Warid Internet. So I used the following command:
nmcli con up id 'Warid Internet'
- Your connection should be established by now. If you haven’t configured your modem, then or for any other reason, you can use the UUID instead of the device name. In that case, the command format would be like this:
nmcli con up uuid your_modems_uuid
It could be anything. You can find the UUID with the same command used while looking for the device name. That is:
nmcli con list
My modem’s UUID is c33c7339-cda1-492f-8222-24982ga81cj. Therefore, I used the following command:
nmcli con up uuid c33c7339-cda1-492f-8222-24982ga81cj
- Just replace the up in the aforementioned commands with down to disconnect the mobile broadband. For example:
nmcli con down id 'Warid Internet'
I hope this helps.