2019-03-12 04:36:50 +00:00
|
|
|
|
# networksetup
|
|
|
|
|
|
2021-08-02 09:41:09 +01:00
|
|
|
|
> 网络系统首选项配置工具。
|
2022-07-29 07:13:36 +01:00
|
|
|
|
> 更多信息:<https://support.apple.com/guide/remote-desktop/about-networksetup-apdd0c5a2d5/mac>.
|
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}}`
|
|
|
|
|
|
2022-03-27 06:25:15 +01:00
|
|
|
|
- 连接到给定的 Wi-Fi 网络 Connect to a particular Wi-Fi network:
|
2019-03-12 04:36:50 +00:00
|
|
|
|
|
2024-01-01 09:38:53 +00:00
|
|
|
|
`networksetup -setairportnetwork {{en0}} {{无线网 SSID}} {{密码}}`
|