Linux下命令行连接wifi

查看网络设备

$ iw dev
phy#0
	Unnamed/non-netdev interface
		wdev 0x2
		addr bc:a8:a6:dc:b0:ea
		type P2P-device
		txpower 0.00 dBm
	Interface wlp1s0
		ifindex 3
		wdev 0x1
		addr bc:a8:a6:dc:b0:ea
		ssid AndroidAP1f05
		type managed
		channel 11 (2462 MHz), width: 20 MHz, center1: 2462 MHz
		txpower 0.00 dBm
		multicast TXQ:
			qsz-byt	qsz-pkt	flows	drops	marks	overlmt	hashcoltx-bytes	tx-packets
			0	0	0	0	0	0	0	00

查看wifi连接状态

$ iw wlp1s0 link

打开网络设备

$ sudo ip link set wlp1s0 up

扫描可用的wifi

$ sudo iw wlp1s0 scan | grep SSID
	SSID: AndroidAP1f05
		 * Multiple BSSID
	SSID: @PHICOMM_E0
	SSID: \xe5\xbc\xa0\xe5\x9d\xa4wifi
	SSID: TP-LINK_EC92
	SSID: \xe5\xbc\xa0\xe5\x9d\xa4wifi-5G
	SSID: @PHICOMM_F3
	SSID: FAST_9C10
	SSID: Tenda_CD2868
	SSID: PHICOMM_6F1764
	SSID: TP-LINK_1D30
	SSID: 
	SSID: @PHICOMM_18

输入SSID+密码连接wifi

$ nmcli dev wifi connect wifi的ssid password wifi的密码

你可能感兴趣的:(Linux)