Master Network Management with nmcli Command
Discover the capabilities of nmcli, a robust command-line utility for managing NetworkManager. Explore a range of functionalities including checking online status, obtaining general status information, listing available devices and connections, importing configurations, changing hostnames, deleting setups, reloading connections, controlling interface status, connecting to Wi-Fi networks, creating Wi-Fi hotspots, managing VPN connections, setting DNS, and more. Take full control of your network configuration with nmcli.
Ask networkmanager about online status
nm-online
Get General status
nmcli general
Listing NetworkManager polkit permissions
nmcli general permissions
Print info line by line
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
SSID="ssid"
PASSWORD="WPA3-PASS"
nmcli device wifi connect "$SSID" password "$PASSWORD"
Connect to a password-protected wifi network and get asked for password
SSID="ssid"
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
Set DNS
nmcli con mod <connectionName> ipv4.dns "8.8.8.8 8.8.4.4"
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 }'