--wait <0-maxint>
0 : means "do not wait". nmcli exits immediatelly with success.
1... : if operation doesn't finish within the timeout, nmcli exits with an error
That way it is not displayed by default:
$ nmcli general status
But can be explicitly requested:
$ nmcli -t -f running,version general status
$ nmcli -f all general status
E.g. Fedora initscripts do this in
/etc/sysconfig/network-scripts/network-functions
is_nm_running ()
{
[ "$(LANG=C nmcli -t --fields running nm status 2>/dev/null)" = "running" ]
}
A few examples:
nmcli --ask connection add
nmcli connection add type ethernet
nmcli -p connection add type ethernet con-name "my ethernet connection 1"
nmcli connection add type ethernet ip4 192.168.100.5/24
nmcli connection add type ethernet ip4 192.168.100.100/24 gw4 192.168.100.1 ip4 1.2.3.4 ip6 abbe::cafe
nmcli connection add type ethernet ifname eth0
nmcli connection add type ethernet autoconnect no ifname eth0
nmcli connection add type wifi con-name Rakosnicek ssid Brcalnik
nmcli --ask connection add type wifi con-name My_WiFi
nmcli c a type infiniband con-name Infi1 transport-mode connected
nmcli c a type bluetooth addr 12:54:00:fd:db:26
nmcli c a type bluetooth addr 12:54:00:fd:db:26 bt-type dun-cdma
nmcli c a type gsm apn internet
nmcli c a type cdma
nmcli c a type bond
nmcli c a type bond ifname mybond0 mode active-backup
nmcli c a ifname maxipes-fik type vlan dev eth0 id 55
nmcli c a con-name VLAN1 type vlan dev eth0 id 44 ingress "2:4,3:55" egress "1:3" flags 6
nmcli c a type bridge ifname br0 stp on ip4 10.0.0.25
nmcli c a ifname eth0 type bridge-slave master 30fc816a-e7dd-4ae7-a86e-ab0c9cee51c2 hairpin no path-cost 333 priority 20
nmcli c a type bridge-slave master br2
nmc_string_to_int() - converts string to signed long int (decimal)
nmc_string_to_uint() - converts string to unsigned long int (decimal)
nmc_string_to_int_base() - converts string to signed long int with given base
nmc_string_to_uint_base() - converts string to unsigned long int with given base
This function checks whether a string is contained among allowed strings. It
performs case-insensitive comparison and supports shortcuts if they are unique.
It returns a pointer to the found string in allowed array, or NULL.
Add a new libnm-glib method to get the type description for a device,
and use it in nmcli. For most types, the type description is based on
the class name, but for NMDeviceGeneric, it comes from the
:type-description property.
If there are no slaves after the timeout, exit nmcli with an error, assuming
that NM is waiting for slaves to finish activation:
"(bondx) "IPv4 config waiting until slaves are ready"
"(bondx) "IPv6 config waiting until slaves are ready"
nmcli general logging [level <log level>] [domains <log domains>]
Examples:
nmcli general logging - print current level and domains values
nmcli general logging level ERR - change logging level to ERR
nmcli general logging level DEBUG domains DNS - change logging level to DEBUG and domains to DNS
nmcli g l domains DEFAULT - set default log domains (the ones active when NM)
They basically contain operations previously available via 'nmcli nm'.
'nmcli nm' is still kept for backward compatibility.
Usage:
nmcli switch [all|networking|wifi|wwan|wimax [on/off]]
nmcli general [status|permissions]
Examples:
nmcli switch all - show all switches
nmcli switch wifi off - switch Wi-Fi off
nmcli g s - show NM status
nmcli g p - show NM permissions
Examples:
nmcli device show - shows details for all available devices
nmcli device show eth0 - shows details for eth0
nmcli device show em1.25 - shows details for em1.25 VLAN device
This requests NetworkManager to perform scanning for Wi-Fi networks.
NetworkManager scans periodically, but this command can be used by impatient
users who don't want to wait for the next scan.
Direct D-Bus API call example:
gdbus call --system -d org.freedesktop.NetworkManager \
-o /org/freedesktop/NetworkManager/Devices/2 \
-m org.freedesktop.NetworkManager.Device.Wireless.RequestScan {}
The static connection profiles are 'configured'.
So, now we have:
nmcli connection show configured [[id|uuid|path] <ID>]
- shows configured connections
nmcli connection show active [[id|uuid|path|apath] <ID>]
- shows active connections
Without arguments the commands list all connections; with an argument, the details
of the requested connection is shown.
and also allow identifying connetions with 'path' and 'apath' that accepts either
the whole D-Dus path or just an index.
nmcli connection down [id|uuid|path|apath] <ID>
Example:
nmcli connection down con1
nmcli connection down con1 con2 apath 1 id my-wifi
and also allow identifying connetions with 'path' that accepts either the whole
D-Dus path or just an index.
nmcli connection up [id|uuid|path] <ID>
Examples:
nmcli connection up "My Home Wi-Fi"
nmcli connection up id "My Home Wi-Fi"
nmcli connection up path /org/freedesktop/NetworkManager/Settings/18
nmcli connection up path 18
Note:
In order to be able to identify connections with just index number, the 'path'
keyword has to be provided.
and also allow identifying connetions with 'path' that accepts either the whole
D-Dus path or just an index.
nmcli connection delete [id|uuid|path] <ID>
Example:
nmcli connection delete "Wired 1" "Wired 2" "Wired 3"
nmcli connection delete id MyMain id "Quick Test 1" "Quick Test 2" path 23 path 47
And also allow:
- identifying connetions with 'path'/'apath' accepting either the whole D-Dus path
or just an index
- multiple connections on cmdline at once
nmcli connection list [[id|uuid|path] <ID>]
nmcli connection status [[id|uuid|path|apath] <ID>]
Examples:
nmcli c l
nmcli c l "My Wi-Fi 1" airpoirt1 cpath 23 id "My Wi-Fi 2"
nmcli c s
nmcli c s apath 1 ee19b893-e2a7-42cf-ac82-34506f07a05f