}

nmcli Cheatsheet 2026 — NetworkManager Command Line Reference

nmcli Cheatsheet 2026 — NetworkManager Command Line Reference

nmcli is the command-line interface for NetworkManager. It controls every aspect of network configuration on Linux desktops and servers managed by NetworkManager, with no GUI required. This cheatsheet covers the most frequently used commands grouped by task.


General status and help

nmcli general status          # Overall NetworkManager status
nmcli general hostname        # Show current hostname
nmcli general hostname myhost # Set hostname
nmcli monitor                 # Watch for connection/device events in real time
nmcli --help                  # Top-level help
nmcli connection --help       # Help for connection subcommands

Device commands

Command Description
nmcli device List all devices and their state
nmcli device status Same as above, explicit
nmcli device show eth0 Detailed info for a specific device
nmcli device connect eth0 Activate the device with its default connection
nmcli device disconnect eth0 Disconnect without deleting the connection
nmcli device reapply eth0 Reapply connection config without full reconnect
nmcli device set eth0 managed yes Hand device back to NetworkManager
nmcli device set eth0 managed no Release device from NetworkManager control
nmcli device monitor Watch device events in real time

Connection commands

nmcli connection show                    # List all saved connections
nmcli connection show --active           # List only active connections
nmcli connection show "Home WiFi"        # Show all settings for a connection
nmcli connection up "Home WiFi"          # Activate a connection by name
nmcli connection down "Home WiFi"        # Deactivate a connection
nmcli connection delete "Home WiFi"      # Delete a saved connection permanently
nmcli connection reload                  # Reload all connection files from disk
nmcli connection modify "MyConn" \
  connection.autoconnect yes             # Enable autoconnect for a connection

WiFi operations

nmcli radio wifi                         # Show WiFi radio state (enabled/disabled)
nmcli radio wifi on                      # Enable WiFi radio
nmcli radio wifi off                     # Disable WiFi radio

nmcli device wifi list                   # List visible access points
nmcli device wifi list ifname wlan0      # Scan on a specific interface
nmcli device wifi rescan                 # Force a fresh scan

# Connect to an open network
nmcli device wifi connect "MySSID" ifname wlan0

# Connect to a WPA2 network
nmcli device wifi connect "MySSID" password "mypassword" ifname wlan0

# Connect and save as a named connection
nmcli device wifi connect "MySSID" \
  password "mypassword" \
  name "Home WiFi" \
  ifname wlan0

To connect to a hidden network:

nmcli device wifi connect "HiddenSSID" \
  password "mypassword" \
  hidden yes

Static IP configuration

Replace DHCP with a static address on an existing connection named eth0:

nmcli connection modify eth0 \
  ipv4.method manual \
  ipv4.addresses "192.168.1.100/24" \
  ipv4.gateway "192.168.1.1" \
  ipv4.dns "8.8.8.8,1.1.1.1"

nmcli connection up eth0

To revert to DHCP:

nmcli connection modify eth0 \
  ipv4.method auto \
  ipv4.addresses "" \
  ipv4.gateway "" \
  ipv4.dns ""

nmcli connection up eth0

Creating new connections from scratch

# New Ethernet connection with static IP
nmcli connection add \
  type ethernet \
  con-name "office-eth" \
  ifname eth0 \
  ipv4.method manual \
  ipv4.addresses "10.0.0.50/24" \
  ipv4.gateway "10.0.0.1" \
  ipv4.dns "10.0.0.1"

# New connection using DHCP
nmcli connection add \
  type ethernet \
  con-name "dhcp-eth" \
  ifname eth0 \
  ipv4.method auto

DNS configuration

# Set DNS servers on an existing connection
nmcli connection modify eth0 ipv4.dns "1.1.1.1 8.8.8.8"

# Add a DNS search domain
nmcli connection modify eth0 ipv4.dns-search "example.com internal.lan"

# Ignore DNS servers pushed by DHCP and use only manual ones
nmcli connection modify eth0 ipv4.ignore-auto-dns yes

# Apply changes
nmcli connection up eth0

Check effective DNS configuration:

nmcli device show eth0 | grep IP4.DNS

VPN connections

NetworkManager supports VPN plugins (OpenVPN, WireGuard, L2TP, etc.). Once a VPN connection is imported or configured:

nmcli connection show          # Find the VPN connection name
nmcli connection up "MyVPN"    # Connect
nmcli connection down "MyVPN"  # Disconnect

Import an OpenVPN config file:

nmcli connection import type openvpn file /path/to/config.ovpn
nmcli connection up "config"

Check VPN status:

nmcli connection show --active | grep vpn

Hotspot / access point creation

Create a WiFi hotspot on wlan0:

nmcli device wifi hotspot \
  ifname wlan0 \
  ssid "MyHotspot" \
  password "secretpass"

For a persistent hotspot saved as a connection:

nmcli connection add \
  type wifi \
  con-name "hotspot" \
  ifname wlan0 \
  ssid "MyHotspot" \
  mode ap \
  ipv4.method shared \
  wifi-sec.key-mgmt wpa-psk \
  wifi-sec.psk "secretpass"

nmcli connection up hotspot

Stop the hotspot:

nmcli connection down hotspot

IPv6 management

# Disable IPv6 on a connection
nmcli connection modify eth0 ipv6.method disabled

# Set static IPv6
nmcli connection modify eth0 \
  ipv6.method manual \
  ipv6.addresses "2001:db8::1/64" \
  ipv6.gateway "2001:db8::ff"

# Enable IPv6 SLAAC (auto)
nmcli connection modify eth0 ipv6.method auto

Output formatting tips

nmcli -t -f NAME,STATE connection show        # Terse output (for scripting)
nmcli -f ALL device wifi list                 # Show all fields
nmcli --mode tabular device                   # Force tabular format
nmcli -g IP4.ADDRESS device show eth0         # Get only the IPv4 address

Common field names reference

Object Useful fields
connection NAME, UUID, TYPE, DEVICE, STATE, AUTOCONNECT
device DEVICE, TYPE, STATE, CONNECTION, CON-PATH
wifi AP SSID, BSSID, CHAN, RATE, SIGNAL, SECURITY
IP IP4.ADDRESS, IP4.GATEWAY, IP4.DNS, IP6.ADDRESS

Troubleshooting

nmcli general logging level DEBUG domains ALL   # Enable verbose logging
journalctl -u NetworkManager -f                 # Follow NM logs
nmcli connection show "MyConn" | grep -i error  # Check for config errors
nmcli device wifi list                          # Confirm the AP is visible before connecting