Skip to content

nmcli | Cheatsheet

Ask networkmanager about online status


Get General status

nmcli general

Listing NetworkManager polkit permissions

nmcli general permissions
nmcli dev show

List all the available device

nmcli dev status

Show info about connections

nmcli connection show

Import wireguard config to nmcli

nmcli connection import type wireguard file "/path/to/wg0.conf"

Show devices

nmcli devices

Show the Network Manager status of all network interfaces

nmcli dev status

List all connection

nmcli con show

List the current settings for the connection name

nmcli con show name

Check if NetworkManager is running

nmcli -t -f RUNNING general

List all the configuration of interface

nmcli con show eth2

Change hostname using nmcli

nmcli general hostname

Delete setup

nmcli con del "eth1"

Delete Setup

nmcli con del "Wired connection 1"

Reload connection using nmcli (restart)

nmcli con reload

Set Wifi down

nmcli connection down id Wifi

Set Wifi up

nmcli connection up id Wifi

Set Modem down

nmcli connection down id MODEM

Set Modem up

nmcli connection up id MODEM

Set Ethernet down

nmcli connection down id Wired

Set Ethernet up

nmcli connection up id Wired

Listing available Wi-Fi APs

nmcli device wifi list

Connect to a password-protected wifi network

nmcli device wifi connect "$SSID" password "$PASSWORD"

Connect to a password-protected wifi network and get asked for password

nmcli --ask device wifi connect "$SSID"

Showing general information and properties for a Wi-Fi interface

nmcli -p -f general,wifi-properties device show wlan0

Add wifi-hotspot helpo

nmcli dev wifi hotspot

Create wifi-hotspot

nmcli dev \
    wifi hotspot \
    ifname wlp2s0 \
    con-name  wuseman \
    ssid SSID-wuseman \
    password "SSID-wuseman-password"

Show wifi password

nmcli dev wifi show-password

Set vpn connection up

nmcli --ask con up my-vpn-con


nmcli con mod <connectionName> ipv4.dns ""

Ignore autodns

nmcli con mod <connectionName> ipv4.ignore-auto-dns yes

Show active connections

nmcli -g name,type connection  show  --active|awk -F: '/ethernet|wireless/ { print $1 }'