1NMCLI(1) General Commands Manual NMCLI(1)
2
3
4
6 nmcli - command-line tool for controlling NetworkManager
7
9 nmcli [OPTIONS...] {help | general | networking | radio | connection |
10 device | agent | monitor} [COMMAND] [ARGUMENTS...]
11
13 nmcli is a command-line tool for controlling NetworkManager and
14 reporting network status. It can be utilized as a replacement for
15 nm-applet or other graphical clients. nmcli is used to create,
16 display, edit, delete, activate, and deactivate network connections, as
17 well as control and display network device status. See nmcli-
18 examples(7) for ready to run nmcli examples.
19
20 Typical uses include:
21
22 • Scripts: Utilize NetworkManager via nmcli instead of managing
23 network connections manually. nmcli supports a terse output format
24 which is better suited for script processing. Note that
25 NetworkManager can also execute scripts, called "dispatcher
26 scripts", in response to network events. See NetworkManager(8) for
27 details about these dispatcher scripts.
28
29 • Servers, headless machines, and terminals: nmcli can be used to
30 control NetworkManager without a GUI, including creating, editing,
31 starting and stopping network connections and viewing network
32 status.
33
35 -a | --ask
36 When using this option nmcli will stop and ask for any missing
37 required arguments, so do not use this option for non-interactive
38 purposes like scripts. This option controls, for example, whether
39 you will be prompted for a password if it is required for
40 connecting to a network.
41
42 -c | --colors {yes | no | auto}
43 This option controls color output (using terminal escape
44 sequences). yes enables colors, no disables them, auto only
45 produces colors when standard output is directed to a terminal. The
46 default value is auto.
47
48 The actual colors used are configured as described in terminal-
49 colors.d(5). Please refer to the COLORS section for a list of color
50 names supported by nmcli.
51
52 If the environment variable NO_COLOR is set (to any value), then
53 coloring is disabled with mode "auto". Explicitly enabling coloring
54 overrides the environment variable.
55
56 --complete-args
57 Instead of conducting the desired action, nmcli will list possible
58 completions for the last argument. This is useful to implement
59 argument completion in shell.
60
61 The exit status will indicate success or return a code 65 to
62 indicate the last argument is a file name.
63
64 NetworkManager ships with command completion support for GNU Bash.
65
66 -e | --escape {yes | no}
67 Whether to escape : and \ characters in terse tabular mode. The
68 escape character is \.
69
70 If omitted, default is yes.
71
72 -f | --fields {field1,field2... | all | common}
73 This option is used to specify what fields (column names) should be
74 printed. Valid field names differ for specific commands. List
75 available fields by providing an invalid value to the --fields
76 option. all is used to print all valid field values of the
77 command. common is used to print common field values of the
78 command.
79
80 If omitted, default is common.
81
82 -g | --get-values {field1,field2... | all | common}
83 This option is used to print values from specific fields. It is
84 basically a shortcut for --mode tabular --terse --fields and is a
85 convenient way to retrieve values for particular fields. The values
86 are printed one per line without headers.
87
88 If a section is specified instead of a field, the section name will
89 be printed followed by colon separated values of the fields
90 belonging to that section, all on the same line.
91
92 -h | --help
93 Print help information.
94
95 -m | --mode {tabular | multiline}
96 Switch between tabular and multiline output:
97
98 tabular
99 Output is a table where each line describes a single entry.
100 Columns define particular properties of the entry.
101
102 multiline
103 Each entry comprises multiple lines, each property on its own
104 line. The values are prefixed with the property name.
105
106 If omitted, default is tabular for most commands. For the commands
107 producing more structured information, that cannot be displayed on
108 a single line, default is multiline. Currently, they are:
109
110 • nmcli connection show ID
111
112 • nmcli device show
113
114 -p | --pretty
115 Output is pretty. This causes nmcli to produce easily readable
116 outputs for humans, i.e. values are aligned, headers are printed,
117 etc.
118
119 -s | --show-secrets
120 When using this option nmcli will display passwords and secrets
121 that might be present in an output of an operation. This option
122 also influences echoing passwords typed by user as an input.
123
124 -t | --terse
125 Output is terse. This mode is designed and suitable for computer
126 (script) processing.
127
128 -v | --version
129 Show nmcli version.
130
131 -w | --wait seconds
132 This option sets a timeout period for which nmcli will wait for
133 NetworkManager to finish operations. It is especially useful for
134 commands that may take a longer time to complete, e.g. connection
135 activation.
136
137 Specifying a value of 0 instructs nmcli not to wait but to exit
138 immediately with a status of success. The default value depends on
139 the executed command.
140
142 nmcli general {status | hostname | permissions | logging}
143 [ARGUMENTS...]
144
145 Use this command to show NetworkManager status and permissions. You can
146 also get and change system hostname, as well as NetworkManager logging
147 level and domains.
148
149 status
150 Show overall status of NetworkManager. This is the default action,
151 when no additional command is provided for nmcli general.
152
153 hostname [hostname]
154 Get and change system hostname. With no arguments, this prints
155 currently configured hostname. When you pass a hostname, it will be
156 handed over to NetworkManager to be set as a new system hostname.
157
158 Note that the term "system" hostname may also be referred to as
159 "persistent" or "static" by other programs or tools. The hostname
160 is stored in /etc/hostname file in most distributions. For example,
161 systemd-hostnamed service uses the term "static" hostname and it
162 only reads the /etc/hostname file when it starts.
163
164 permissions
165 Show the permissions a caller has for various authenticated
166 operations that NetworkManager provides, like enable and disable
167 networking, changing Wi-Fi and WWAN state, modifying connections,
168 etc.
169
170 logging [level level] [domains domains...]
171 Get and change NetworkManager logging level and domains. Without
172 any argument current logging level and domains are shown. In order
173 to change logging state, provide level and, or, domain parameters.
174 See NetworkManager.conf(5) for available level and domain values.
175
177 nmcli networking {on | off | connectivity} [ARGUMENTS...]
178
179 Query NetworkManager networking status, enable and disable networking.
180
181 on, off
182 Enable or disable networking control by NetworkManager. All
183 interfaces managed by NetworkManager are deactivated when
184 networking is disabled.
185
186 connectivity [check]
187 Get network connectivity state. The optional check argument tells
188 NetworkManager to re-check the connectivity, else the most recent
189 known connectivity state is displayed without re-checking.
190
191 Possible states are:
192
193 none
194 the host is not connected to any network.
195
196 portal
197 the host is behind a captive portal and cannot reach the full
198 Internet.
199
200 limited
201 the host is connected to a network, but it has no access to the
202 Internet.
203
204 full
205 the host is connected to a network and has full access to the
206 Internet.
207
208 unknown
209 the connectivity status cannot be found out.
210
212 nmcli radio {all | wifi | wwan} [ARGUMENTS...]
213
214 Show radio switches status, or enable and disable the switches.
215
216 wifi [on | off]
217 Show or set status of Wi-Fi in NetworkManager. If no arguments are
218 supplied, Wi-Fi status is printed; on enables Wi-Fi; off disables
219 Wi-Fi.
220
221 wwan [on | off]
222 Show or set status of WWAN (mobile broadband) in NetworkManager. If
223 no arguments are supplied, mobile broadband status is printed; on
224 enables mobile broadband, off disables it.
225
226 all [on | off]
227 Show or set all previously mentioned radio switches at the same
228 time.
229
231 nmcli monitor
232
233 Observe NetworkManager activity. Watches for changes in connectivity
234 state, devices or connection profiles.
235
236 See also nmcli connection monitor and nmcli device monitor to watch for
237 changes in certain devices or connections.
238
240 nmcli connection {show | up | down | modify | add | edit | clone |
241 delete | monitor | reload | load | import | export}
242 [ARGUMENTS...]
243
244 NetworkManager stores all network configuration as "connections", which
245 are collections of data (Layer2 details, IP addressing, etc.) that
246 describe how to create or connect to a network. A connection is
247 "active" when a device uses that connection's configuration to create
248 or connect to a network. There may be multiple connections that apply
249 to a device, but only one of them can be active on that device at any
250 given time. The additional connections can be used to allow quick
251 switching between different networks and configurations.
252
253 Consider a machine which is usually connected to a DHCP-enabled
254 network, but sometimes connected to a testing network which uses static
255 IP addressing. Instead of manually reconfiguring eth0 each time the
256 network is changed, the settings can be saved as two connections which
257 both apply to eth0, one for DHCP (called default) and one with the
258 static addressing details (called testing). When connected to the
259 DHCP-enabled network the user would run nmcli con up default , and when
260 connected to the static network the user would run nmcli con up
261 testing.
262
263 show [--active] [--order [+-]category:...]
264 List in-memory and on-disk connection profiles, some of which may
265 also be active if a device is using that connection profile.
266 Without a parameter, all profiles are listed. When --active option
267 is specified, only the active profiles are shown.
268
269 The --order option can be used to get custom ordering of
270 connections. The connections can be ordered by active status
271 (active), name (name), type (type) or D-Bus path (path). If
272 connections are equal according to a sort order category, an
273 additional category can be specified. The default sorting order is
274 equivalent to --order active:name:path. + or no prefix means
275 sorting in ascending order (alphabetically or in numbers), - means
276 reverse (descending) order. The category names can be abbreviated
277 (e.g. --order -a:na).
278
279 show [--active] [id | uuid | path | apath] ID...
280 Show details for specified connections. By default, both static
281 configuration and active connection data are displayed. When
282 --active option is specified, only the active profiles are taken
283 into account. Use global --show-secrets option to display secrets
284 associated with the profile.
285
286 id, uuid, path and apath keywords can be used if ID is ambiguous.
287 Optional ID-specifying keywords are:
288
289 id
290 the ID denotes a connection name.
291
292 uuid
293 the ID denotes a connection UUID.
294
295 path
296 the ID denotes a D-Bus static connection path in the format of
297 /org/freedesktop/NetworkManager/Settings/num or just num.
298
299 apath
300 the ID denotes a D-Bus active connection path in the format of
301 /org/freedesktop/NetworkManager/ActiveConnection/num or just
302 num.
303
304 It is possible to filter the output using the global --fields
305 option. Use the following values:
306
307 profile
308 only shows static profile configuration.
309
310 active
311 only shows active connection data (when the profile is active).
312
313 You can also specify particular fields. For static configuration,
314 use setting and property names as described in nm-settings-nmcli(5)
315 manual page. For active data use GENERAL, IP4, DHCP4, IP6, DHCP6,
316 VPN.
317
318 When no command is given to the nmcli connection, the default
319 action is nmcli connection show.
320
321 up [id | uuid | path] ID [ifname ifname] [ap BSSID] [passwd-file file]
322 Activate a connection. The connection is identified by its name,
323 UUID or D-Bus path. If ID is ambiguous, a keyword id, uuid or path
324 can be used. When requiring a particular device to activate the
325 connection on, the ifname option with interface name should be
326 given. If the ID is not given an ifname is required, and
327 NetworkManager will activate the best available connection for the
328 given ifname. In case of a VPN connection, the ifname option
329 specifies the device of the base connection. The ap option specify
330 what particular AP should be used in case of a Wi-Fi connection.
331
332 If --wait option is not specified, the default timeout will be 90
333 seconds.
334
335 See connection show above for the description of the ID-specifying
336 keywords.
337
338 Available options are:
339
340 ifname
341 interface that will be used for activation.
342
343 ap
344 BSSID of the AP which the command should connect to (for Wi-Fi
345 connections).
346
347 passwd-file
348 some networks may require credentials during activation. You
349 can give these credentials using this option. Each line of the
350 file should contain one password in the form:
351
352 setting_name.property_name:the password
353
354 For example, for WPA Wi-Fi with PSK, the line would be
355
356 802-11-wireless-security.psk:secret12345
357
358 For 802.1X password, the line would be
359
360 802-1x.password:my 1X password
361
362
363 nmcli also accepts wifi-sec and wifi strings instead of
364 802-11-wireless-security. When NetworkManager requires a
365 password and it is not given, nmcli will ask for it when run
366 with --ask. If --ask was not passed, NetworkManager can ask
367 another secret agent that may be running (typically a GUI
368 secret agent, such as nm-applet or gnome-shell).
369
370 down [id | uuid | path | apath] ID...
371 Deactivate a connection from a device without preventing the device
372 from further auto-activation. Multiple connections can be passed to
373 the command.
374
375 Be aware that this command deactivates the specified active
376 connection, but the device on which the connection was active, is
377 still ready to connect and will perform auto-activation by looking
378 for a suitable connection that has the 'autoconnect' flag set. Note
379 that the deactivating connection profile is internally blocked from
380 autoconnecting again. Hence it will not autoconnect until reboot or
381 until the user performs an action that unblocks autoconnect, like
382 modifying the profile or explicitly activating it.
383
384 In most cases you may want to use device disconnect command
385 instead.
386
387 The connection is identified by its name, UUID or D-Bus path. If ID
388 is ambiguous, a keyword id, uuid, path or apath can be used.
389
390 See connection show above for the description of the ID-specifying
391 keywords.
392
393 If --wait option is not specified, the default timeout will be 10
394 seconds.
395
396 modify [--temporary] [id | uuid | path] ID
397 {option value | [+|-]setting.property value}...
398 Add, modify or remove properties in the connection profile.
399
400 To set the property just specify the property name followed by the
401 value. An empty value ("") resets the property value to the
402 default.
403
404 See nm-settings-nmcli(5) for complete reference of setting and
405 property names, their descriptions and default values. The setting
406 and property can be abbreviated provided they are unique.
407
408 If you want to append an item or a flag to the existing value, use
409 + prefix for the property name or alias. If you want to remove
410 items from a container-type or flag property, use - prefix. For
411 certain properties you can also remove elements by specifying the
412 zero-based index(es). The + and - modifiers only have a real effect
413 for properties that support them. These are for example multi-value
414 (container) properties or flags like ipv4.dns, ip4, ipv4.addresses,
415 bond.options, 802-1x.phase1-auth-flags etc.
416
417 The connection is identified by its name, UUID or D-Bus path. If ID
418 is ambiguous, a keyword id, uuid or path can be used.
419
420 modify [--temporary] [id | uuid | path] ID remove setting
421 Removes a setting from the connection profile.
422
423 add [save {yes | no}] {option value | [+|-]setting.property value}...
424 Create a new connection using specified properties.
425
426 You need to describe the newly created connections with the
427 property and value pairs. See nm-settings-nmcli(5) for the complete
428 reference. The syntax is the same as of the nmcli connection modify
429 command.
430
431 To construct a meaningful connection you at the very least need to
432 set the connection.type property (or use the type alias) to one of
433 known NetworkManager connection types:
434
435 • 6lowpan
436
437 • 802-11-olpc-mesh (alias olpc-mesh)
438
439 • 802-11-wireless (alias wifi)
440
441 • 802-3-ethernet (alias ethernet)
442
443 • adsl
444
445 • bluetooth
446
447 • bond
448
449 • bond-slave (deprecated for ethernet with master)
450
451 • bridge
452
453 • bridge-slave (deprecated for ethernet with master)
454
455 • cdma
456
457 • dummy
458
459 • generic
460
461 • gsm
462
463 • infiniband
464
465 • ip-tunnel
466
467 • macsec
468
469 • macvlan
470
471 • olpc-mesh
472
473 • ovs-bridge
474
475 • ovs-dpdk
476
477 • ovs-interface
478
479 • ovs-patch
480
481 • ovs-port
482
483 • pppoe
484
485 • team
486
487 • team-slave (deprecated for ethernet with master)
488
489 • tun
490
491 • veth
492
493 • vlan
494
495 • vpn
496
497 • vrf
498
499 • vxlan
500
501 • wifi-p2p
502
503 • wimax
504
505 • wireguard
506
507 • wpan
508
509 The most typical uses are described in the EXAMPLES section.
510
511 Aside from the properties and values two special options are
512 accepted:
513
514 save
515 Controls whether the connection should be persistent, i.e.
516 NetworkManager should store it on disk (default: yes).
517
518 --
519 If a single -- argument is encountered it is ignored. This is
520 for compatibility with older versions on nmcli.
521
522 edit {[id | uuid | path] ID | [type type] [con-name name] }
523 Edit an existing connection or add a new one, using an interactive
524 editor.
525
526 The existing connection is identified by its name, UUID or D-Bus
527 path. If ID is ambiguous, a keyword id, uuid, or path can be used.
528 See connection show above for the description of the ID-specifying
529 keywords. Not providing an ID means that a new connection will be
530 added.
531
532 The interactive editor will guide you through the connection
533 editing and allow you to change connection parameters according to
534 your needs by means of a simple menu-driven interface. The editor
535 indicates what settings and properties can be modified and provides
536 in-line help.
537
538 Available options:
539
540 type
541 type of the new connection; valid types are the same as for
542 connection add command.
543
544 con-name
545 name for the new connection. It can be changed later in the
546 editor.
547
548 See also nm-settings-nmcli(5) for all NetworkManager settings and
549 property names, and their descriptions; and nmcli-examples(7) for
550 sample editor sessions.
551
552 clone [--temporary] [id | uuid | path] ID new_name
553 Clone a connection. The connection to be cloned is identified by
554 its name, UUID or D-Bus path. If ID is ambiguous, a keyword id,
555 uuid or path can be used. See connection show above for the
556 description of the ID-specifying keywords. new_name is the name of
557 the new cloned connection. The new connection will be the exact
558 copy except the connection.id (new_name) and connection.uuid
559 (generated) properties.
560
561 The new connection profile will be saved as persistent unless
562 --temporary option is specified, in which case the new profile
563 won't exist after NetworkManager restart.
564
565 delete [id | uuid | path] ID...
566 Delete a configured connection. The connection to be deleted is
567 identified by its name, UUID or D-Bus path. If ID is ambiguous, a
568 keyword id, uuid or path can be used. See connection show above for
569 the description of the ID-specifying keywords.
570
571 If --wait option is not specified, the default timeout will be 10
572 seconds.
573
574 monitor [id | uuid | path] ID...
575 Monitor connection profile activity. This command prints a line
576 whenever the specified connection changes. The connection to be
577 monitored is identified by its name, UUID or D-Bus path. If ID is
578 ambiguous, a keyword id, uuid or path can be used. See connection
579 show above for the description of the ID-specifying keywords.
580
581 Monitors all connection profiles in case none is specified. The
582 command terminates when all monitored connections disappear. If you
583 want to monitor connection creation consider using the global
584 monitor with nmcli monitor command.
585
586 reload
587 Reload all connection files from disk. NetworkManager does not
588 monitor changes to connection. So you need to use this command in
589 order to tell NetworkManager to re-read the connection profiles
590 from disk when a change was made to them.
591
592 load filename...
593 Load/reload one or more connection files from disk. Use this after
594 manually editing a connection file to ensure that NetworkManager is
595 aware of its latest state.
596
597 import [--temporary] type type file file
598 Import an external/foreign configuration as a NetworkManager
599 connection profile. The type of the input file is specified by type
600 option.
601
602 Only VPN configurations are supported at the moment. The
603 configuration is imported by NetworkManager VPN plugins. type
604 values are the same as for vpn-type option in nmcli connection add.
605 VPN configurations are imported by VPN plugins. Therefore the
606 proper VPN plugin has to be installed so that nmcli could import
607 the data.
608
609 The imported connection profile will be saved as persistent unless
610 --temporary option is specified, in which case the new profile
611 won't exist after NetworkManager restart.
612
613 export [id | uuid | path] ID [file]
614 Export a connection.
615
616 Only VPN connections are supported at the moment. A proper VPN
617 plugin has to be installed so that nmcli could export a connection.
618 If no file is provided, the VPN configuration data will be printed
619 to standard output.
620
622 nmcli device {status | show | set | connect | reapply | modify |
623 disconnect | delete | monitor | wifi | lldp}
624 [ARGUMENTS...]
625
626 Show and manage network interfaces.
627
628 status
629 Print status of devices.
630
631 This is the default action if no command is specified to nmcli
632 device.
633
634 show [ifname]
635 Show detailed information about devices. Without an argument, all
636 devices are examined. To get information for a specific device, the
637 interface name has to be provided.
638
639 set [ifname] ifname [autoconnect {yes | no}] [managed {yes | no}]
640 Set device properties.
641
642 connect ifname
643 Connect the device. NetworkManager will try to find a suitable
644 connection that will be activated. It will also consider
645 connections that are not set to auto connect.
646
647 If no compatible connection exists, a new profile with default
648 settings will be created and activated. This differentiates nmcli
649 connection up ifname "$DEVICE" from nmcli device connect "$DEVICE"
650
651 If --wait option is not specified, the default timeout will be 90
652 seconds.
653
654 reapply ifname
655 Attempt to update device with changes to the currently active
656 connection made since it was last applied.
657
658 modify ifname {option value | [+|-]setting.property value}...
659 Modify the settings currently active on the device.
660
661 This command lets you do temporary changes to a configuration
662 active on a particular device. The changes are not preserved in the
663 connection profile.
664
665 See nm-settings-nmcli(5) for the list of available properties.
666 Please note that some properties can't be changed on an already
667 connected device.
668
669 disconnect ifname...
670 Disconnect a device and prevent the device from automatically
671 activating further connections without user/manual intervention.
672 Note that disconnecting software devices may mean that the devices
673 will disappear.
674
675 If --wait option is not specified, the default timeout will be 10
676 seconds.
677
678 delete ifname...
679 Delete a device. The command removes the interface from the system.
680 Note that this only works for software devices like bonds, bridges,
681 teams, etc. Hardware devices (like Ethernet) cannot be deleted by
682 the command.
683
684 If --wait option is not specified, the default timeout will be 10
685 seconds.
686
687 monitor [ifname...]
688 Monitor device activity. This command prints a line whenever the
689 specified devices change state.
690
691 Monitors all devices in case no interface is specified. The monitor
692 terminates when all specified devices disappear. If you want to
693 monitor device addition consider using the global monitor with
694 nmcli monitor command.
695
696 wifi [list [--rescan | auto | no | yes] [ifname ifname] [bssid BSSID]]
697 List available Wi-Fi access points. The ifname and bssid options
698 can be used to list APs for a particular interface or with a
699 specific BSSID, respectively.
700
701 By default, nmcli ensures that the access point list is no older
702 than 30 seconds and triggers a network scan if necessary. The
703 --rescan can be used to either force or disable the scan regardless
704 of how fresh the access point list is.
705
706 wifi connect (B)SSID [password password] [wep-key-type {key | phrase}]
707 [ifname ifname] [bssid BSSID] [name name] [private {yes | no}]
708 [hidden {yes | no}]
709 Connect to a Wi-Fi network specified by SSID or BSSID. The command
710 finds a matching connection or creates one and then activates it on
711 a device. This is a command-line counterpart of clicking an SSID in
712 a GUI client. If a connection for the network already exists, it is
713 possible to bring up (activate) the existing profile as follows:
714 nmcli con up id name. Note that only open, WEP and WPA-PSK networks
715 are supported if no previous connection exists. It is also assumed
716 that IP configuration is obtained via DHCP.
717
718 If --wait option is not specified, the default timeout will be 90
719 seconds.
720
721 Available options are:
722
723 password
724 password for secured networks (WEP or WPA).
725
726 wep-key-type
727 type of WEP secret, either key for ASCII/HEX key or phrase for
728 passphrase.
729
730 ifname
731 interface that will be used for activation.
732
733 bssid
734 if specified, the created connection will be restricted just
735 for the BSSID.
736
737 name
738 if specified, the connection will use the name (else NM creates
739 a name itself).
740
741 private
742 if set to yes, the connection will only be visible to the user
743 who created it. Otherwise, the connection is system-wide, which
744 is the default.
745
746 hidden
747 set to yes when connecting for the first time to an AP not
748 broadcasting its SSID. Otherwise, the SSID would not be found
749 and the connection attempt would fail.
750
751 wifi hotspot [ifname ifname] [con-name name] [ssid SSID]
752 [band {a | bg}] [channel channel] [password password]
753 Create a Wi-Fi hotspot. The command creates a hotspot connection
754 profile according to Wi-Fi device capabilities and activates it on
755 the device. The hotspot is secured with WPA if device/driver
756 supports that, otherwise WEP is used. Use connection down or device
757 disconnect to stop the hotspot.
758
759 Parameters of the hotspot can be influenced by the optional
760 parameters:
761
762 ifname
763 what Wi-Fi device is used.
764
765 con-name
766 name of the created hotspot connection profile.
767
768 ssid
769 SSID of the hotspot.
770
771 band
772 Wi-Fi band to use.
773
774 channel
775 Wi-Fi channel to use.
776
777 password
778 password to use for the created hotspot. If not provided, nmcli
779 will generate a password. The password is either WPA pre-shared
780 key or WEP key.
781
782 Note that --show-secrets global option can be used to print the
783 hotspot password. It is useful especially when the password was
784 generated.
785
786 wifi rescan [ifname ifname] [ssid SSID...]
787 Request that NetworkManager immediately re-scan for available
788 access points. NetworkManager scans Wi-Fi networks periodically,
789 but in some cases it can be useful to start scanning manually (e.g.
790 after resuming the computer). By using ssid, it is possible to scan
791 for a specific SSID, which is useful for APs with hidden SSIDs. You
792 can provide multiple ssid parameters in order to scan more SSIDs.
793
794 This command does not show the APs, use nmcli device wifi list for
795 that.
796
797 wifi show-password [ifname ifname]
798 Show the details of the active Wi-Fi networks, including the
799 secrets.
800
801 lldp [list [ifname ifname]]
802 Display information about neighboring devices learned through the
803 Link Layer Discovery Protocol (LLDP). The ifname option can be used
804 to list neighbors only for a given interface. The protocol must be
805 enabled in the connection settings.
806
808 nmcli agent {secret | polkit | all}
809
810 Run nmcli as a NetworkManager secret agent, or polkit agent.
811
812 secret
813 Register nmcli as a NetworkManager secret agent and listen for
814 secret requests. You usually do not need this command, because
815 nmcli can handle secrets when connecting to networks. However, you
816 may find the command useful when you use another tool for
817 activating connections and you do not have a secret agent available
818 (like nm-applet).
819
820 polkit
821 Register nmcli as a polkit agent for the user session and listen
822 for authorization requests. You do not usually need this command,
823 because nmcli can handle polkit actions related to NetworkManager
824 operations (when run with --ask). However, you may find the command
825 useful when you want to run a simple text based polkit agent and
826 you do not have an agent of a desktop environment. Note that
827 running this command makes nmcli handle all polkit requests, not
828 only NetworkManager related ones, because only one polkit agent can
829 run for the session.
830
831 all
832 Runs nmcli as both NetworkManager secret and a polkit agent.
833
835 Implicit coloring can be disabled by an empty file
836 /etc/terminal-colors.d/nmcli.disable.
837
838 See terminal-colors.d(5) for more details about colorization
839 configuration. The logical color names supported by nmcli are:
840
841 connection-activated
842 A connection that is active.
843
844 connection-activating
845 Connection that is being activated.
846
847 connection-disconnecting
848 Connection that is being disconnected.
849
850 connection-invisible
851 Connection whose details is the user not permitted to see.
852
853 connectivity-full
854 Connectivity state when Internet is reachable.
855
856 connectivity-limited
857 Connectivity state when only a local network reachable.
858
859 connectivity-none
860 Connectivity state when the network is disconnected.
861
862 connectivity-portal
863 Connectivity state when a captive portal hijacked the connection.
864
865 connectivity-unknown
866 Connectivity state when a connectivity check didn't run.
867
868 device-activated
869 Device that is connected.
870
871 device-activating
872 Device that is being configured.
873
874 device-disconnected
875 Device that is not connected.
876
877 device-firmware-missing
878 Warning of a missing device firmware.
879
880 device-plugin-missing
881 Warning of a missing device plugin.
882
883 device-unavailable
884 Device that is not available for activation.
885
886 device-disabled
887 Device is disabled by software or hardware kill switch.
888
889 manager-running
890 Notice that the NetworkManager daemon is available.
891
892 manager-starting
893 Notice that the NetworkManager daemon is being initially connected.
894
895 manager-stopped
896 Notice that the NetworkManager daemon is not available.
897
898 permission-auth
899 An action that requires user authentication to get permission.
900
901 permission-no
902 An action that is not permitted.
903
904 permission-yes
905 An action that is permitted.
906
907 prompt
908 Prompt in interactive mode.
909
910 state-asleep
911 Indication that NetworkManager in suspended state.
912
913 state-connected-global
914 Indication that NetworkManager in connected to Internet.
915
916 state-connected-local
917 Indication that NetworkManager in local network.
918
919 state-connected-site
920 Indication that NetworkManager in connected to networks other than
921 Internet.
922
923 state-connecting
924 Indication that NetworkManager is establishing a network
925 connection.
926
927 state-disconnected
928 Indication that NetworkManager is disconnected from a network.
929
930 state-disconnecting
931 Indication that NetworkManager is being disconnected from a
932 network.
933
934 wifi-signal-excellent
935 Wi-Fi network with an excellent signal level.
936
937 wifi-signal-fair
938 Wi-Fi network with a fair signal level.
939
940 wifi-signal-good
941 Wi-Fi network with a good signal level.
942
943 wifi-signal-poor
944 Wi-Fi network with a poor signal level.
945
946 wifi-signal-unknown
947 Wi-Fi network that hasn't been actually seen (a hidden AP).
948
949 disabled
950 A property that is turned off.
951
952 enabled
953 A property that is turned on.
954
956 nmcli's behavior is affected by the following environment variables.
957
958 LC_ALL
959 If set to a non-empty string value, it overrides the values of all
960 the other internationalization variables.
961
962 LC_MESSAGES
963 Determines the locale to be used for internationalized messages.
964
965 LANG
966 Provides a default value for the internationalization variables
967 that are unset or null.
968
970 Be aware that nmcli is localized and that is why the output depends on
971 your environment. This is important to realize especially when you
972 parse the output.
973
974 Call nmcli as LC_ALL=C nmcli to be sure the locale is set to C while
975 executing in a script.
976
977 LC_ALL, LC_MESSAGES, LANG variables specify the LC_MESSAGES locale
978 category (in that order), which determines the language that nmcli uses
979 for messages. The C locale is used if none of these variables are set,
980 and this locale uses English messages.
981
983 nmcli exits with status 0 if it succeeds, a value greater than 0 is
984 returned if an error occurs.
985
986 0
987 Success – indicates the operation succeeded.
988
989 1
990 Unknown or unspecified error.
991
992 2
993 Invalid user input, wrong nmcli invocation.
994
995 3
996 Timeout expired (see --wait option).
997
998 4
999 Connection activation failed.
1000
1001 5
1002 Connection deactivation failed.
1003
1004 6
1005 Disconnecting device failed.
1006
1007 7
1008 Connection deletion failed.
1009
1010 8
1011 NetworkManager is not running.
1012
1013 10
1014 Connection, device, or access point does not exist.
1015
1016 65
1017 When used with --complete-args option, a file name is expected to
1018 follow.
1019
1021 This section presents various examples of nmcli usage. If you want even
1022 more, please refer to nmcli-examples(7) manual page.
1023
1024 nmcli -t -f RUNNING general
1025 tells you whether NetworkManager is running or not.
1026
1027 nmcli -t -f STATE general
1028 shows the overall status of NetworkManager.
1029
1030 nmcli radio wifi off
1031 switches Wi-Fi off.
1032
1033 nmcli connection show
1034 lists all connections NetworkManager has.
1035
1036 nmcli -p -m multiline -f all con show
1037 shows all configured connections in multi-line mode.
1038
1039 nmcli connection show --active
1040 lists all currently active connections.
1041
1042 nmcli -f name,autoconnect c s
1043 shows all connection profile names and their auto-connect property.
1044
1045 nmcli -p connection show "My default em1"
1046 shows details for "My default em1" connection profile.
1047
1048 nmcli --show-secrets connection show "My Home Wi-Fi"
1049 shows details for "My Home Wi-Fi" connection profile with all
1050 passwords. Without --show-secrets option, secrets would not be
1051 displayed.
1052
1053 nmcli -f active connection show "My default em1"
1054 shows details for "My default em1" active connection, like IP, DHCP
1055 information, etc.
1056
1057 nmcli -f profile con s "My wired connection"
1058 shows static configuration details of the connection profile with
1059 "My wired connection" name.
1060
1061 nmcli -p con up "My wired connection" ifname eth0
1062 activates the connection profile with name "My wired connection" on
1063 interface eth0. The -p option makes nmcli show progress of the
1064 activation.
1065
1066 nmcli con up 6b028a27-6dc9-4411-9886-e9ad1dd43761 ap 00:3A:98:7C:42:D3
1067 connects the Wi-Fi connection with UUID
1068 6b028a27-6dc9-4411-9886-e9ad1dd43761 to the AP with BSSID
1069 00:3A:98:7C:42:D3.
1070
1071 nmcli device status
1072 shows the status for all devices.
1073
1074 nmcli dev disconnect em2
1075 disconnects a connection on interface em2 and marks the device as
1076 unavailable for auto-connecting. As a result, no connection will
1077 automatically be activated on the device until the device's
1078 'autoconnect' is set to TRUE or the user manually activates a
1079 connection.
1080
1081 nmcli -f GENERAL,WIFI-PROPERTIES dev show wlan0
1082 shows details for wlan0 interface; only GENERAL and WIFI-PROPERTIES
1083 sections will be shown.
1084
1085 nmcli -f CONNECTIONS device show wlp3s0
1086 shows all available connection profiles for your Wi-Fi interface
1087 wlp3s0.
1088
1089 nmcli dev wifi
1090 lists available Wi-Fi access points known to NetworkManager.
1091
1092 nmcli dev wifi con "Cafe Hotspot 1" password caffeine name "My cafe"
1093 creates a new connection named "My cafe" and then connects it to
1094 "Cafe Hotspot 1" SSID using password "caffeine". This is mainly
1095 useful when connecting to "Cafe Hotspot 1" for the first time. Next
1096 time, it is better to use nmcli con up id "My cafe" so that the
1097 existing connection profile can be used and no additional is
1098 created.
1099
1100 nmcli -s dev wifi hotspot con-name QuickHotspot
1101 creates a hotspot profile and connects it. Prints the hotspot
1102 password the user should use to connect to the hotspot from other
1103 devices.
1104
1105 nmcli dev modify em1 ipv4.method shared
1106 starts IPv4 connection sharing using em1 device. The sharing will
1107 be active until the device is disconnected.
1108
1109 nmcli dev modify em1 ipv6.address 2001:db8::a:bad:c0de
1110 temporarily adds an IP address to a device. The address will be
1111 removed when the same connection is activated again.
1112
1113 nmcli connection add type ethernet autoconnect no ifname eth0
1114 non-interactively adds an Ethernet connection tied to eth0
1115 interface with automatic IP configuration (DHCP), and disables the
1116 connection's autoconnect flag.
1117
1118 nmcli c a ifname Maxipes-fik type vlan dev eth0 id 55
1119 non-interactively adds a VLAN connection with ID 55. The connection
1120 will use eth0 and the VLAN interface will be named Maxipes-fik.
1121
1122 nmcli c a ifname eth0 type ethernet ipv4.method disabled ipv6.method
1123 link-local
1124 non-interactively adds a connection that will use eth0 Ethernet
1125 interface and only have an IPv6 link-local address configured.
1126
1127 nmcli connection edit ethernet-em1-2
1128 edits existing "ethernet-em1-2" connection in the interactive
1129 editor.
1130
1131 nmcli connection edit type ethernet con-name "yet another Ethernet
1132 connection"
1133 adds a new Ethernet connection in the interactive editor.
1134
1135 nmcli con mod ethernet-2 connection.autoconnect no
1136 modifies 'autoconnect' property in the 'connection' setting of
1137 'ethernet-2' connection.
1138
1139 nmcli con mod "Home Wi-Fi" wifi.mtu 1350
1140 modifies 'mtu' property in the 'wifi' setting of 'Home Wi-Fi'
1141 connection.
1142
1143 nmcli con mod em1-1 ipv4.method manual ipv4.addr "192.168.1.23/24
1144 192.168.1.1, 10.10.1.5/8, 10.0.0.11"
1145 sets manual addressing and the addresses in em1-1 profile.
1146
1147 nmcli con modify ABC +ipv4.dns 8.8.8.8
1148 appends a Google public DNS server to DNS servers in ABC profile.
1149
1150 nmcli con modify ABC -ipv4.addresses "192.168.100.25/24 192.168.1.1"
1151 removes the specified IP address from (static) profile ABC.
1152
1153 nmcli con import type openvpn file ~/Downloads/frootvpn.ovpn
1154 imports an OpenVPN configuration to NetworkManager.
1155
1156 nmcli con export corp-vpnc /home/joe/corpvpn.conf
1157 exports NetworkManager VPN profile corp-vpnc as standard Cisco
1158 (vpnc) configuration.
1159
1161 nmcli accepts abbreviations, as long as they are a unique prefix in the
1162 set of possible options. As new options get added, these abbreviations
1163 are not guaranteed to stay unique. For scripting and long term
1164 compatibility it is therefore strongly advised to spell out the full
1165 option names.
1166
1168 There are probably some bugs. If you find a bug, please report it to
1169 your distribution or upstream at
1170 https://gitlab.freedesktop.org/NetworkManager/NetworkManager.
1171
1173 nmcli-examples(7), nm-settings-nmcli(5), nm-online(1),
1174 NetworkManager(8), NetworkManager.conf(5), nm-applet(1), nm-connection-
1175 editor(1), terminal-colors.d(5).
1176
1177
1178
1179NetworkManager 1.30.4 NMCLI(1)