2019-03-12 04:36:50 +00:00
|
|
|
|
# networksetup
|
|
|
|
|
|
|
|
|
|
> 网络系统首选项配置工具.
|
|
|
|
|
|
|
|
|
|
- 列出可用的网络服务源(以太网、Wi-Fi、蓝牙等):
|
|
|
|
|
|
|
|
|
|
`networksetup -listallnetworkservices`
|
|
|
|
|
|
|
|
|
|
- 显示特定网络设备的配置信息:
|
|
|
|
|
|
|
|
|
|
`networksetup -getinfo {{"Wi-Fi"}}`
|
|
|
|
|
|
2019-10-20 03:34:33 +01:00
|
|
|
|
- 获取当前连接的 Wi-Fi 网络名称(Wi-Fi 设备通常为 en0 或 en1):
|
2019-03-12 04:36:50 +00:00
|
|
|
|
|
|
|
|
|
`networksetup -getairportnetwork {{en0}}`
|
|
|
|
|
|
2019-10-20 03:34:33 +01:00
|
|
|
|
- 连接到给定的 Wi-Fi 网络 Connect to a particular Wi-Fi network:
|
2019-03-12 04:36:50 +00:00
|
|
|
|
|
2019-10-20 03:34:33 +01:00
|
|
|
|
`networksetup -setairportnetwork {{en0}} {{"无线网 SSID"}} {{密码}}`
|