2023年最新ubuntu连wifi的方法
Posted 19 months ago rust cli linux bash ubuntu wifi
安装nm
apt install network-manager net-tools
首先,列出所有设备
$ nmcli d
DEVICE TYPE STATE CONNECTION
...
wlan0 wifi disconnected --
然后打开设备
$ nmcli r wifi on
列出所有wifi
$ nmcli d wifi list
* SSID MODE CHAN RATE SIGNAL BARS SECURITY
...
my_wifi Infra 5 54 Mbit/s 89 ▂▄▆█ WPA2
链接wifi
$ nmcli d wifi connect my_wifi password <password>
如果是隐藏wifi的话
$ nmcli c add type wifi con-name <name> ifname wlan0 ssid <ssid>
$ nmcli c modify <name> wifi-sec.key-mgmt wpa-psk wifi-sec.psk <password>
$ nmcli c up <name>
如果想开热点
$ nmcli d wifi hotspot ifname <wifi_iface> ssid <ssid> password <password>