nmcli

nmcli(NetworkManager)

EXAMPLES
This section presents various examples of nmcli usage. If you want even more,
please refer to nmcli-examples(7) manual page.

   nmcli -t -f RUNNING general
       tells you whether NetworkManager is running or not.

   nmcli -t -f STATE general
       shows the overall status of NetworkManager.

   nmcli radio wifi off
       switches Wi-Fi off.

   nmcli connection show
       lists all connections NetworkManager has.

   nmcli -p -m multiline -f all con show
       shows all configured connections in multi-line mode.

   nmcli connection show --active
       lists all currently active connections.

   nmcli -f name,autoconnect c s
       shows all connection profile names and their auto-connect property.

   nmcli -p connection show "My default em1"
       shows details for "My default em1" connection profile.

   nmcli --show-secrets connection show "My Home WiFi"
       shows details for "My Home WiFi" connection profile with all passwords. Without
       --show-secrets option, secrets would not be displayed.

  nmcli -f active connection show "My default em1"
       shows details for "My default em1" active connection, like IP, DHCP
       information, etc.

   nmcli -f profile con s "My wired connection"
       shows static configuration details of the connection profile with "My wired
       connection" name.

   nmcli -p con up "My wired connection" ifname eth0
       activates the connection profile with name "My wired connection" on interface
       eth0. The -p option makes nmcli show progress of the activation.

   nmcli con up 6b028a27-6dc9-4411-9886-e9ad1dd43761 ap 00:3A:98:7C:42:D3
       connects the Wi-Fi connection with UUID 6b028a27-6dc9-4411-9886-e9ad1dd43761 to
       the AP with BSSID 00:3A:98:7C:42:D3.

   nmcli device status
       shows the status for all devices.

   nmcli dev disconnect em2
       disconnects a connection on interface em2 and marks the device as unavailable
       for auto-connecting. As a result, no connection will automatically be activated
       on the device until the device's 'autoconnect' is set to TRUE or the user
       manually activates a connection.

   nmcli -f GENERAL,WIFI-PROPERTIES dev show wlan0
       shows details for wlan0 interface; only GENERAL and WIFI-PROPERTIES sections
       will be shown.

   nmcli -f CONNECTIONS device show wlp3s0
       shows all available connection profiles for your Wi-Fi interface wlp3s0.

  nmcli dev wifi
       lists available Wi-Fi access points known to NetworkManager.

   nmcli dev wifi con "Cafe Hotspot 1" password caffeine name "My cafe"
       creates a new connection named "My cafe" and then connects it to "Cafe Hotspot
       1" SSID using password "caffeine". This is mainly useful when connecting to
       "Cafe Hotspot 1" for the first time. Next time, it is better to use nmcli con
       up id "My cafe" so that the existing connection profile can be used and no
       additional is created.

   nmcli -s dev wifi hotspot con-name QuickHotspot
       creates a hotspot profile and connects it. Prints the hotspot password the user
       should use to connect to the hotspot from other devices.

   nmcli dev modify em1 ipv4.method shared
       starts IPv4 connection sharing using em1 device. The sharing will be active
       until the device is disconnected.

   nmcli dev modify em1 ipv6.address 2001:db8::a:bad:c0de
       temporarily adds an IP address to a device. The address will be removed when
       the same connection is activated again.

   nmcli connection add type ethernet autoconnect no ifname eth0
       non-interactively adds an Ethernet connection tied to eth0 interface with
       automatic IP configuration (DHCP), and disables the connection's autoconnect
       flag.

   nmcli c a ifname Maxipes-fik type vlan dev eth0 id 55
       non-interactively adds a VLAN connection with ID 55. The connection will use
       eth0 and the VLAN interface will be named Maxipes-fik.

  nmcli c a ifname eth0 type ethernet ipv4.method disabled ipv6.method link-local
       non-interactively adds a connection that will use eth0 Ethernet interface and
       only have an IPv6 link-local address configured.

   nmcli connection edit ethernet-em1-2
       edits existing "ethernet-em1-2" connection in the interactive editor.

   nmcli connection edit type ethernet con-name "yet another Ethernet connection"
       adds a new Ethernet connection in the interactive editor.

   nmcli con mod ethernet-2 connection.autoconnect no
       modifies 'autoconnect' property in the 'connection' setting of 'ethernet-2'
       connection.

   nmcli con mod "Home Wi-Fi" wifi.mtu 1350
       modifies 'mtu' property in the 'wifi' setting of 'Home Wi-Fi' connection.

   nmcli con mod em1-1 ipv4.method manual ipv4.addr "192.168.1.23/24 192.168.1.1,
   10.10.1.5/8, 10.0.0.11"
       sets manual addressing and the addresses in em1-1 profile.

   nmcli con modify ABC +ipv4.dns 8.8.8.8
       appends a Google public DNS server to DNS servers in ABC profile.

   nmcli con modify ABC -ipv4.addresses "192.168.100.25/24 192.168.1.1"
       removes the specified IP address from (static) profile ABC.

   nmcli con import type openvpn file ~/Downloads/frootvpn.ovpn
       imports an OpenVPN configuration to NetworkManager.

   nmcli con export corp-vpnc /home/joe/corpvpn.conf
       exports NetworkManager VPN profile corp-vpnc as standard Cisco (vpnc)
       configuration.