Home > Network Management > nmcli

nmcli: NetworkManager Command-Line Tool

nmcli is a command-line interface tool for controlling NetworkManager. It allows you to easily manage network connections, devices, Wi-Fi, and other network-related settings. It is very useful for automating and configuring networks in server environments or scripts.

Overview

nmcli interacts with the NetworkManager daemon to manage network configurations. You can perform various tasks such as creating, modifying, and deleting network connection profiles, enabling/disabling network devices, and scanning and connecting to Wi-Fi networks.

Key Features

These are the core functionalities provided by nmcli.

  • Manage network connection profiles (create, modify, delete)
  • Check and control network device status
  • Scan and connect to Wi-Fi networks
  • Change connection settings like IP addresses and DNS servers
  • Enable/disable network radios (Wi-Fi, WWAN)

Key Options and Objects

nmcli is used in the format 'nmcli [options] object command'. Here, 'object' represents the target of management (e.g., connection, device), and 'command' specifies the particular action for that object.

Global Options

Generated command:

Try combining the commands.

Description:

`nmcli` Executes the command.

Combine the above options to virtually execute commands with AI.

Usage Examples

Here are various scenarios for managing networks using nmcli.

Check NetworkManager General Status

nmcli general status

Checks the current status of NetworkManager and its hostname information.

View All Network Connection Profiles

nmcli connection show

Displays all connection profiles defined on the system, including active and inactive connections.

View Status of All Network Devices

nmcli device status

Checks the current status of all network devices, such as Ethernet and Wi-Fi.

Scan for Available Wi-Fi Networks and List Them

nmcli device wifi list

Scans for available Wi-Fi networks in the vicinity and displays information such as SSID and signal strength.

Turn Off Wi-Fi Radio

nmcli radio wifi off

Disables the Wi-Fi functionality of the system.

Activate a Specific Connection

nmcli connection up "My_Wired_Connection"

Activates the network connection profile named 'My_Wired_Connection'. Replace with your actual connection name.

Tips & Precautions

Here are some tips and precautions for using nmcli more effectively.

Useful Tips

  • Most nmcli commands require root privileges. Use them with `sudo`.
  • You can get detailed help for specific objects or commands by typing `nmcli help` or `nmcli <object> help`.
  • Refer to the full manual page by typing `man nmcli`.
  • When using in scripts, it is recommended to combine the `-t` (terse) and `-f` (fields) options to extract only the necessary information.

Same category commands