nmcli-networking
Manage NetworkManager from the command line
TLDR
Show the networking status of NetworkManager
Enable or disable networking and all interfaces managed by NetworkManager
Show the last known connectivity state
Show the current connectivity state
SYNOPSIS
The core command is nmcli. Its general syntax for performing networking tasks is:
nmcli [OPTIONS] OBJECT { COMMAND | help }
Common OBJECTS relevant to networking include:
connection (or c): For managing network connection profiles (e.g., Wi-Fi network definitions, Ethernet configurations).
device (or d): For managing network interfaces (e.g., eth0, wlan0).
radio (or r): For managing global Wi-Fi and WWAN radio states.
general (or g): For managing NetworkManager's overall status and hostname.
monitor (or m): For monitoring NetworkManager events and changes.
Examples:
nmcli connection show
nmcli device status
nmcli radio wifi off
PARAMETERS
-t, --terse
Output in terse format, suitable for scripting. It typically produces colon-separated key-value pairs.
-p, --pretty
Output in a human-readable, 'pretty' format with aligned columns and headers (often the default for interactive use).
-f, --fields
Specify which fields to output. Use 'all' to show all available fields for the given object.
-e, --escape
Escape colons and backslashes in terse mode output, useful when dealing with data that might contain these characters.
-n, --nocheck
Don't check for NetworkManager availability. Forces nmcli to run even if NetworkManager is not detected.
-v, --version
Show the nmcli version information and exit.
-h, --help
Print the general help message or help for a specific object/command.
-o, --overview
Print an overview of available fields for a connection when used with 'connection show'.
-s, --show-secrets
Show secrets (e.g., Wi-Fi passwords) when displaying connection details. Use with extreme caution as it exposes sensitive information.
-a, --ask
Ask for missing parameters interactively if necessary.
-w, --wait
Wait for NetworkManager's startup completion for a specified number of seconds before executing the command.
-r, --retry
Retry operations on NetworkManager failure for a specified number of times.
DESCRIPTION
nmcli-networking is not a standalone command but refers to the use of the nmcli (NetworkManager Command Line Interface) tool for managing network connections and devices. nmcli is the primary command-line interface for controlling the NetworkManager daemon, which dynamically configures and manages network connections on Linux systems. It allows users and scripts to view, add, modify, delete, activate, and deactivate network connections, and manage various networking devices like Ethernet, Wi-Fi, VPNs, and mobile broadband. It provides a robust and consistent way to manage network settings, simplifying complex configurations and enabling automation for system administrators and power users.
CAVEATS
nmcli relies heavily on the NetworkManager daemon. If NetworkManager is not running, disabled, or encounters critical errors, nmcli will not function as expected.
Many operations, especially those that modify system-wide network configurations or bring up/down interfaces, require root privileges (e.g., by using sudo).
Care must be taken when modifying or deactivating active network connections, as it can temporarily disrupt network connectivity, potentially leading to loss of access.
Its terse output format (-t
) is highly powerful for scripting but requires careful parsing due to its colon-separated structure and potential for escaped characters.
CONNECTION PROFILES VS. DEVICES
nmcli conceptually distinguishes between 'connection profiles' and 'devices'. A 'connection profile' (managed by nmcli connection
) is a set of configuration details for how to connect to a network (e.g., 'Home Wi-Fi', 'Office Ethernet'). A 'device' (managed by nmcli device
) is a physical or virtual network interface (e.g., eth0, wlan0). A connection profile can be activated on a compatible device, effectively configuring that device to connect to a specific network.
ACTIVATION AND DEACTIVATION
Networking in nmcli often involves the concept of 'activation' and 'deactivation'. Activating a connection profile on a device brings up the network connection, configuring the device according to the profile's settings. Deactivating a device or connection profile disconnects it from the network.
AUTO-CONNECT FEATURE
Connection profiles can be configured to automatically connect when their associated device becomes available. This 'auto-connect' feature simplifies network management for users, as the system can automatically establish connections without manual intervention upon boot or device hot-plugging.
HISTORY
NetworkManager was introduced to Linux distributions to simplify network configuration, particularly for portable devices (laptops) that frequently change network environments. It aimed to provide a consistent and dynamic way to manage various network types (wired, wireless, mobile broadband, VPNs) without manual intervention. nmcli emerged as its robust command-line interface, offering a powerful alternative to graphical tools and enabling comprehensive scripting of network tasks. Its development has focused on achieving feature parity with other NetworkManager interfaces, improving user experience for command-line users, and enhancing its capabilities for system administrators and automation.
SEE ALSO
NetworkManager(8), nmcli(1), nmcli-examples(7), nmtui(1), nm-connection-editor(1), ip(8), ifconfig(8)