Manage Network Connections From the Linux Command Line with nmcli (original) (raw)

Last Updated : 14 May, 2026

Network connectivity is a fundamental requirement for any Linux system, especially in servers and headless environments where graphical tools are not available. The nmcli (Network Manager Command-Line Interface) is a command-line utility used to manage network connections through the terminal.

Example 1: List All Network Connections

Displays all saved network configurations on the system. Helps identify available connections along with details like name, UUID, type, and associated device.

**Command:

nmcli connection show

**Output:

Viewing connections

Viewing connections

Example 2: Check Device Status

Shows the current state of all network devices. Helps identify whether devices are connected or disconnected along with additional information like the device type and the connection type it is associated with.

**Command:

nmcli dev status

**Output:

check device status

check device status

Example 3: Display Device Details

Shows detailed information about a specific network device. Useful for checking IP address, MAC address, driver details, and other configuration data.

**Command:

nmcli device show eno1

**Output:

Display Device Details

Display Device Details

Example 4: Add a New Ethernet Connection

Creates a new network connection for a specified interface. Useful for setting up a new network or configuring additional interfaces on the system.

**Syntax:

nmcli connection add type ifname con-name

**Command:

nmcli connection add type ethernet ifname eth1 con-name my_eth_connection

**Output:

202Adding new ethernet connection4-01-11_17-11

Adding new ethernet connection

**Verification Command:

nmcli connection show

**Output:

nmcli connection show

nmcli connection show

Example 5: Modify Connection Settings

Modifies the settings of an existing network connection. Commonly used to configure static IP addresses, gateway, and other network parameters.

**Syntax:

nmcli connection modify

**Command:

nmcli connection modify my_eth_connection ipv4.addresses "192.168.1.2/24" ipv4.gateway "192.168.1.1"

**Note: Changes may require reactivating the connection to take effect

**Command:

nmcli connection up my_eth_connection

Syntax

nmcli [OPTIONS] OBJECT { COMMAND | help }

**Common OBJECT Values

Options Available in nmcli Command in Linux

1. -t, --terse

Displays output in a compact, machine-readable format by removing headers and formatting.

**Syntax:

nmcli -t

**Example: Display Device Status in Pretty Format

Shows formatted output with headings and aligned columns.

**Command:

nmcli -t device status

**Output:

nmcli-tdevi_show

2. -p, --pretty

Displays output in a well-structured and human-readable format with headings and spacing.

**Syntax:

nmcli -p

**Example: Display Device Status in Pretty Format

Shows formatted output with headings and aligned columns.

**Command:

nmcli -p device status

**Output:

nmcli-p_dev_show

3. -m, --mode {tabular | multiline}

Controls how output is displayed by switching between tabular (default) and multiline formats.

**Syntax:

nmcli -m {tabular | multiline}

**Example: Display Device Details in Multiline Format

Shows detailed information where each field is printed on a separate line.

**Command:

nmcli -m multiline device show

**Output:

nmcli-m_dev_show

4. -f, --fields

Displays only selected fields from the output instead of showing all available information.

**Syntax:

nmcli -f

**Example: Display Only General Device Information

Shows only GENERAL fields for each device.

**Command:

nmcli -f GENERAL device show

**Output:

nmcli-f_dev_show

5. -v, --version

Displays the installed version of the nmcli tool.

**Syntax:

nmcli -v

**Output:

nmcli-v

6. -h, --help

Displays help information about nmcli commands and usage.

**Syntax:

nmcli -h

**Output:

nmcli-help