I have a mobile broadband connection that I am often sharing via hotspot on Ubuntu 18.04.2 LTS and Gnome 3.28.2. I can perfectly do this (as described for example here) via GUI. But I would like to realize that with a CLI command (for a toggle switch. How can I determine the command behind this GUI button:
?
Asked
Active
Viewed 1,371 times
1
1 Answers
2
I am confused with the example you have provided in the question.. it uses Unity.. but 18.04 Defaults to GNOME
I assume you are using GNOME and not Unity..
Once you have created the hotspot in any way and once it is active..
run the below command
nmcli device show
and note down the value for GENERAL.CONNECTION:
in my case it is Hotspot-21
Example:
pratap@i3-6550U:~$ nmcli device show
GENERAL.DEVICE: wlp2s0
GENERAL.TYPE: wifi
GENERAL.HWADDR: E0:94:67:64:C5:8F
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: Hotspot-21
now use the commands below to toggle on and off (#Replace Hotspot-21 with your value)
nmcli connection up Hotspot-21
nmcli connection down Hotspot-21
Source: http://manpages.ubuntu.com/manpages/bionic/man1/nmcli.1.html
wifi hotspot [ifname ifname] [con-name name] [ssid SSID] [band {a | bg}] [channel channel]
[password password]
Create a Wi-Fi hotspot. The command creates a hotspot connection profile according to
Wi-Fi device capabilities and activates it on the device. The hotspot is secured with
WPA if device/driver supports that, otherwise WEP is used. Use connection down or
device disconnect to stop the hotspot.
PRATAP-PANABAKA
- 23,201
