Reading Time: 4 minutes

What is nmcli?

nmcli stands for Network Management Command-Line Interface, and is a tool for managing the NetworkManager application and reporting on the status of the network. It can be utilized as a substitution for nm-applet or other similar graphical clients. nmcli is used to display, create, delete, edit, activate, deactivate network connections, and control and display network device status.

Typical uses include:

  • Scripts: Utilize NetworkManager via nmcli rather than managing network connections manually. nmcli supports a terse output format that is healthier fitted to the script process. Note that NetworkManager can even execute scripts, referred to as “dispatcher scripts,” responding to network events.
  • Servers, headless machines, and terminals: nmcli tool can be used to control NetworkManager without a graphical user interface, including creating, deleting, editing, starting and stopping network connections as well as viewing network status.


Before every installation, apply all available upgrades of all packages.

apt-get update && apt-get upgrade


After the system is updated, we will run this command to install nmcli.

apt-get install network-manager

Press “y” when prompted with “Do you want to continue? [Y/n]”. After the installation has completed, we can start the Network Manager with this command.

systemctl start NetworkManager.service 

Next, we will enable Network Manager to start on system boot with using the systemctl command below. 

systemctl enable NetworkManager.service

We will cover more of the basic nmcli commands further along in this article, but the complete reference can be found in the nmcli man page using the “man nmcli” command.


nmcli [option] [command] [arguments]


The main nmcli command are broken down into several objects and subcommands.

  • General
  • Networking
  • RTC (Radio Transmission Control)
  • Activity Monitoring
  • Connection Management
  • Device Management
  • Secret Agent

General Commands

Here is a list of the general commands available for nmcli.

  • Status - This shows the state of the network manager. We can check our network devices status using this command
  • Hostname - This command views and modifies the server hostname. 
  • Permissions -  This command shows the permissions of a user to enact a procedure.
  • Logging - This command views and modifies logging levels.


The specific syntax of these commands are shown below.

nmcli device status 

nmcli general hostname

nmcli general permissions

nmcli general logging



nmcli networking { on | off | connectivity } [ARGUMENTS...]

The networking commands use nmcli to check network status, or to enable or disable networking components.

onoff - This command enables or disables various network connections via nmcli.

Connectivity [check] - nmcli gets the connection state and retains individual network configuration types as connections which contain the associated info on each kind of network connection.

nmcli connection { show | up | down | modify | add | edit | clone | delete | monitor | reload | load | import | export } [ARGUMENTS...]

RTC (Radio Transmission Control)

The RTC or radio command show the status of the radio switches, and enable and disable the switches.


nmcli radio { all | wifi | wwan } [ARGUMENTS…]

Activity Monitoring

The monitor command observes changes in the connectivity state of a device or in the connection profiles.


nmcli monitor

Connection Management

The connection command in nmcli stores the network configurations as "connections", that depicts how to create or connect to a network.


nmcli connection { show | up | down | modify | add | edit | clone | delete | monitor | reload | load | import | export } [ARGUMENTS...]

Device Management

The device command shows and manages all the network interfaces.


nmcli device { status | show | set | connect | reapply | modify | disconnect | delete | monitor | wifi | lldp } [ARGUMENTS…]

Secret Agent

The agent command runs as secret agent, or polkit agent. If the command keeps nmcli running and if a password is required asks the user for it.


nmcli agent { secret | polkit | all }


The nmcli configuration profiles are located in /etc/NetworkManager/system-connections/. Since that folder is empty by default after install, we will need to create a connection profile file called “dhcp-home” and assign it to the device ens33. Since there is only one network card, we will have to switch connection profiles.

root@ubuntu: nmcli con add type ethernet con-name dhcp-home ifname ens33 ipv4.method auto
Connection 'dhcp-home' (0611c2c8-83ad-40f7-b7bb-b57668af203d) successfully added.

We can look into that configuration profile with this command.

cat /etc/NetworkManager/system-connectionsdhcp-home

Notice that the values we configured via the nmcli command like id, type, interface-name, ipv4 method. This type of connection profile will use an IP address provided by the dhcp server. 





Now, to activate new connection profile run this command.

root@ubuntu:~# nmcli con up dhcp-home 
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/1)

Here, we explain how to create a connection profile with a dynamic IP address acquired from the dhcp server. Now let’s see how to create a connection profile with a static IP address. The profile will be named static-home, and it will be assigned to the same ens33 device. 

root@ubuntu:~#  nmcli con add type ethernet con-name static-home  ifname ens33  ip4  gw4 
Connection 'static-home' (b7e6531d-b183-4791-84c1-9de0c249b583) successfully added.

Now, let’s modify the static-home connection profile and add the DNS server with “nmcli con mod static-home ipv4.dns” and check the configuration file again. This time we will grep for dns from the configuration file. 

root@ubuntu:~# nmcli con mod static-home  ipv4.dns
root@ubuntu:~# grep dns /etc/NetworkManager/system-connections/static-home 

We can check if the connection profile with the static IP is configured correctly by pinging or 

root@ubuntu:~# ping
PING ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=128 time=142 ms
64 bytes from ( icmp_seq=2 ttl=128 time=142 ms

PING ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=128 time=25.3 ms

Please note that the IP address and gateway properties have different names when we add or modify a connection. When we are adding connections, we would use “ip4” and “gw4”, after they are modified, you should use “ipv4” and “gwv4”.

To confirm that the IP address of ens33 device is the same as in the configuration file, we can run “ip addr show | grep ens33” and compare it to the address value in the configuration profile file.

In this tutorial, we explained what nmcli is, and how to install and configure it. This covers the basics of NetworkManager or nmcli. I strongly encourage our readers to check man nmclifor a more in-depth review of its usage.

Our Support Teams are filled with talented Linux technicians and System administrators who have intimate knowledge of multiple web hosting technologies, especially those discussed in this article.

If you are a Fully Managed VPS server, Cloud Dedicated, Private Cloud powered by VMware, Private Parent server or a Dedicated server owner and you are uncomfortable with performing any of the steps outlined, we can be reached via phone @800.580.4985, a chat or support ticket to assist you with this process.

Avatar for Leo Porter

About the Author: Leo Porter

I am a 26 years old Linux Technician with almost 2-year experience, learning new things every day. I love troubleshooting and the empowering feeling you get when you help someone to resolve the issue. I like to spend my free time watching Netflix, training in Krav Maga, cycling, or camping if the weather is nice.

Latest Articles

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change the root password in WebHost Manager (WHM)

Read Article