NetworkManager
Manage network connections and configurations
SYNOPSIS
nmcli [OPTIONS] { OBJECT | help }
Common OBJECTS:
general, networking, radio, connection, device, agent
Common COMMANDS for objects:
show, status, up, down, add, modify, delete, connect, disconnect
PARAMETERS
-t, --terse
Output in terse format, suitable for scripting.
-p, --pretty
Output in a more human-readable format, with column headers.
-f, --fields
Specify which fields to output. E.g., 'NAME,UUID,TYPE'.
-e, --escape
Escape all values in terse output (default 'yes').
-m, --mode
Set output mode for tabular output.
-s, --show-secrets
Show connection secrets like Wi-Fi passwords. Use with caution.
-a, --ask
Ask for missing parameters. Interactive prompt for secrets.
-w, --wait
Wait for NetworkManager to finish operations for the specified duration (default '5s').
-v, --version
Show nmcli version.
-h, --help
Print help information.
DESCRIPTION
nmcli is the command-line client for NetworkManager. It provides a comprehensive and scriptable interface to control and configure network connections and devices. With nmcli, users can manage various network types, including Ethernet, Wi-Fi, mobile broadband, and VPNs.
It's designed for both interactive use and scripting, making it ideal for server environments or for automating network configurations. Key functionalities include displaying network status, activating and deactivating connections, adding, modifying, and deleting connection profiles, and controlling device states. nmcli acts as a powerful alternative to graphical network configuration tools, offering granular control over every aspect of NetworkManager's operations.
CAVEATS
NetworkManager Service Required: nmcli commands only work if the NetworkManager daemon is running and active on the system.
Permissions: Modifying network settings or creating connections usually requires root privileges or membership in the appropriate user group (e.g., nmcli, network or wheel depending on distribution setup). Read-only commands generally don't require elevated privileges.
Complexity for Advanced Scenarios: While powerful, complex networking setups involving advanced routing or firewall rules might still require direct configuration of lower-level tools or systemd-networkd for finer control, depending on the integration.
KEY OBJECTS
nmcli operates on several key 'objects', each representing a different aspect of network management:
general: General NetworkManager status and information.
networking: Global networking enable/disable and connectivity status.
radio: Control of Wi-Fi and WWAN radios.
connection: Management of connection profiles (e.g., MyHomeWifi, VPN_Work). This is where you add, modify, delete, activate, or deactivate connections.
device: Management of network interfaces (e.g., eth0, wlan0). You can display device status, connect/disconnect, or scan for Wi-Fi.
agent: Allows registering as a NetworkManager secret agent (e.g., for VPN passwords).
COMMON USE CASES
nmcli is frequently used for:
Connecting to Wi-Fi:
nmcli device wifi connect SSID password "your_password"
Listing Connections:
nmcli connection show
Bringing a Connection Up/Down:
nmcli connection up "Connection Name" / nmcli connection down "Connection Name"
Adding a New Ethernet Connection:
nmcli connection add type ethernet con-name my-eth ifname eth0 ip4 192.168.1.100/24 gw4 192.168.1.1
Displaying Device Status:
nmcli device status
HISTORY
NetworkManager was initiated by Red Hat in 2004 with the goal of making network setup and configuration easier for users, particularly for mobile and wireless networking. It aimed to automatically switch between network connections and manage their states.
The nmcli utility was developed as a modern, scriptable command-line interface to NetworkManager, providing a robust alternative to legacy network configuration scripts (like those used with ifup/ifdown) and complementing graphical tools. Its development focused on offering full control over NetworkManager's capabilities via the terminal, enabling easier integration into scripts and server automation workflows.