sudo nmcli radio wifi off

也可以简化为

sudo nmcli r wifi off

查看wifi的开关状态

nmcli r wifi 

enabled

查看命令用法

nmcli r help

用法:nmcli radio { 命令 | help }

命令 := { all | wifi | wwan }

all | wifi | wwan [ on | off ]

查看nmcli 用法

nmcli help

Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }

OPTIONS
-a, --ask ask for missing parameters
-c, --colors auto|yes|no whether to use colors in output
-e, --escape yes|no escape columns separators in values
-f, --fields <field,...>|all|common specify fields to output
-g, --get-values <field,...>|all|common shortcut for -m tabular -t -f
-h, --help print this help
-m, --mode tabular|multiline output mode
-o, --overview overview mode
-p, --pretty pretty output
-s, --show-secrets allow displaying passwords
-t, --terse terse output
-v, --version show program version
-w, --wait <seconds> set timeout waiting for finishing operations

OBJECT
g[eneral] NetworkManager's general status and operations
n[etworking] overall networking control
r[adio] NetworkManager radio switches
c[onnection] NetworkManager's connections
d[evice] devices managed by NetworkManager
a[gent] NetworkManager secret agent or polkit agent
m[onitor] monitor NetworkManager changes

要关闭所有网络

nmcli n help

用法:nmcli networking { 命令 | help }

命令 := { [ on | off | connectivity ] }

on

off

connectivity [check]

完全启用/禁用网络

nmcli networking off

仅用于WiFi

nmcli radio wifi off

在两种情况下都on可以重新启用。

本文链接地址:https://const.net.cn/354.html

标签: shell, linux

添加新评论