2019-03-12 04:36:50 +00:00
|
|
|
|
# networksetup
|
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
|
> 网络系统首选项配置工具。
|
2019-03-12 04:36:50 +00:00
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
|
- 列出可用的网络服务源(以太网、Wi-Fi、蓝牙等):
|
2019-03-12 04:36:50 +00:00
|
|
|
|
|
|
|
|
|
`networksetup -listallnetworkservices`
|
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
|
- 显示特定网络设备的配置信息:
|
2019-03-12 04:36:50 +00:00
|
|
|
|
|
2020-10-04 18:33:38 +01:00
|
|
|
|
`networksetup -getinfo "{{Wi-Fi}}"`
|
2019-03-12 04:36:50 +00:00
|
|
|
|
|
2021-08-02 09:41:09 +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
|
|
|
|
|
2020-10-04 18:33:38 +01:00
|
|
|
|
`networksetup -setairportnetwork {{en0}} "{{无线网 SSID}}" {{密码}}`
|