close
Skip to main content

nmcli Cheatsheet

By Dejan Panovski Updated on Download PDF

Quick reference for using nmcli to manage NetworkManager devices, connection profiles, Wi-Fi, static IP addresses, DNS, and troubleshooting

The `nmcli` command controls NetworkManager from the terminal. This cheatsheet covers the common commands for checking network status, managing devices and profiles, connecting to Wi-Fi, configuring static IP addresses, and troubleshooting network changes.

Basic Syntax

Use this structure for most nmcli commands.

CommandDescription
nmcli [OPTIONS] OBJECT COMMANDGeneral command syntax
nmcli OBJECT helpShow help for an object
nmcli --versionShow nmcli version
nmcli -t ...Use terse output for scripts
nmcli -f FIELD1,FIELD2 ...Select output fields
nmcli -g FIELD ...Print field values only

General Status

Check NetworkManager state and hostname settings.

CommandDescription
nmcli general statusShow overall NetworkManager status
nmcli networking connectivityCheck internet connectivity state
nmcli general hostnameShow system hostname
sudo nmcli general hostname server01Set system hostname
nmcli general permissionsShow NetworkManager permissions
nmcli general loggingShow logging level and domains

Devices

Inspect and control network interfaces.

CommandDescription
nmcli device statusList devices and connection state
nmcli device show eth0Show detailed device properties
nmcli -f GENERAL,IP4 device show eth0Show selected device sections
sudo nmcli device connect eth0Connect a device
sudo nmcli device disconnect eth0Disconnect a device
nmcli device reapply eth0Reapply active profile settings

Connection Profiles

Manage saved NetworkManager profiles.

CommandDescription
nmcli connection showList all profiles
nmcli connection show --activeList active profiles
nmcli connection show "home-wifi"Show one profile
sudo nmcli connection up "home-wifi"Activate a profile
sudo nmcli connection down "home-wifi"Deactivate a profile
sudo nmcli connection delete "home-wifi"Delete a saved profile

Wi-Fi

Scan networks and connect to wireless profiles.

CommandDescription
nmcli radio wifiShow Wi-Fi radio state
sudo nmcli radio wifi onTurn Wi-Fi on
sudo nmcli radio wifi offTurn Wi-Fi off
nmcli device wifi listScan visible Wi-Fi networks
sudo nmcli device wifi connect "SSID" password "PASSWORD"Connect with password
sudo nmcli --ask device wifi connect "SSID"Prompt for Wi-Fi password
sudo nmcli device wifi connect "SSID" password "PASSWORD" hidden yesConnect to hidden network

Static IPv4

Set or remove manual IPv4 settings on a profile.

CommandDescription
sudo nmcli connection modify "Wired connection 1" ipv4.method manualUse manual IPv4
sudo nmcli connection modify "Wired connection 1" ipv4.addresses 192.168.1.50/24Set static address
sudo nmcli connection modify "Wired connection 1" ipv4.gateway 192.168.1.1Set gateway
sudo nmcli connection modify "Wired connection 1" ipv4.dns "1.1.1.1 9.9.9.9"Set DNS servers
sudo nmcli connection up "Wired connection 1"Apply profile changes
nmcli -g IP4.ADDRESS,IP4.GATEWAY connection show "Wired connection 1"Check IPv4 settings

DHCP and DNS

Return to DHCP or adjust DNS servers.

CommandDescription
sudo nmcli connection modify "Wired connection 1" ipv4.method autoUse DHCP for IPv4
sudo nmcli connection modify "Wired connection 1" ipv4.addresses ""Clear static address
sudo nmcli connection modify "Wired connection 1" ipv4.gateway ""Clear static gateway
sudo nmcli connection modify "Wired connection 1" ipv4.dns ""Clear static DNS
sudo nmcli connection modify "Wired connection 1" +ipv4.dns 8.8.8.8Append DNS server
sudo nmcli connection modify "Wired connection 1" -ipv4.dns 8.8.8.8Remove DNS server

Add Profiles

Create new wired and wireless profiles.

CommandDescription
sudo nmcli connection add type ethernet ifname eth0 con-name "wired-dhcp"Add wired DHCP profile
sudo nmcli connection add type ethernet ifname eth0 con-name "wired-static" ip4 192.168.1.50/24 gw4 192.168.1.1Add wired static profile
sudo nmcli connection add type wifi ifname wlan0 con-name "office-wifi" ssid "Office"Add Wi-Fi profile
sudo nmcli connection modify "office-wifi" wifi-sec.key-mgmt wpa-pskSet WPA-PSK security
sudo nmcli connection modify "office-wifi" wifi-sec.psk "PASSWORD"Set Wi-Fi password
sudo nmcli connection up "wired-static"Activate new profile

Scripting Output

Use stable output formats in scripts.

CommandDescription
nmcli -t connection show --activeTerse active profile list
nmcli -t -f NAME,DEVICE connection show --activeActive names and devices
nmcli -g GENERAL.STATE device show eth0Print device state value
nmcli -g IP4.ADDRESS device show eth0Print IPv4 address values
nmcli -f DEVICE,TYPE,STATE device statusSelect device status fields
nmcli -m multiline connection show "home-wifi"Multiline profile details

Monitor and Reload

Watch changes and reload profile files.

CommandDescription
nmcli monitorWatch NetworkManager events
nmcli device monitor eth0Watch one device
sudo nmcli connection reloadReload profile files from disk
sudo nmcli general reloadReload NetworkManager configuration
sudo nmcli general reload dns-rcRewrite DNS resolver configuration
journalctl -u NetworkManager -n 100Show recent NetworkManager logs

Troubleshooting

Fast checks for common NetworkManager issues.

IssueCheck
NetworkManager is not runningsudo systemctl start NetworkManager
Wi-Fi list is emptysudo nmcli radio wifi on and rfkill list
Wrong profile is activenmcli connection show --active
Static IP did not applysudo nmcli connection up "PROFILE"
DNS is not workingnmcli -g IP4.DNS device show eth0
Permission deniedRun the command with sudo

Use these articles for detailed networking workflows.

GuideDescription
nmcli Command in LinuxComplete nmcli command guide
Linux ip Command with ExamplesInterface, address, and route management
How to Configure Static IP Address on UbuntuNetplan and desktop static IP setup
How to Use the dig CommandDNS lookup and troubleshooting
SSH Command in LinuxRemote shell access and options