How to Use nmcli in Ubuntu

Network manager manages all the network settings of the computer. With which network a machine should be connected, which type of traffic should be allowed and how to save data from the online servers are all managed by the network manager. Network managers have different tools, for example we have nm-connection-editor, nmcli, nm Gnome etc. All the tools or utilities have their own specific functions like nm-connection-editor is used to manage the wired connections of the machine, by Gnome settings we can manage all the network settings easily, by nmcli we can do the setting by the command line mode.

This write-up will demonstrate the installation of the network manager then in detail we will discuss the nmcli command for what purpose and how it can be used.

What is the installation procedure of Network Manager

Though the nmcli is installed by default in Ubuntu but in case if it is not installed we will install the network manager package. For the installation of the network manager we will first update our Ubuntu repository by opening the terminal and entering the following command for updating:

$ sudo apt update

How to Use nmcli in Ubuntu 1

Now we will install the network manager by using the following command.

$ sudo apt install network-manager

How to Use nmcli in Ubuntu 2

As it can be seen that the network manager is already installed. To start the network manager use:

$ sudo systemctl start network-manager

How to Use nmcli in Ubuntu 3

To confirm the above step we will check out the status of the network manager by using systemctl command as:

$ sudo systemctl status network-manager

How to Use nmcli in Ubuntu 4

What is nmcli

Sometimes we are managing the network setting by using the GUI (graphical user interface) but suddenly because of some issues the GUI crashes so we think about the other options to accomplish our results. An alternative to the GUI we have is command line methods. For the command line method we have the “nmcli” through which we can configure the network settings. There are different features which we can do by using this command. We will discuss them briefly.

nmcli command for General functions : Command nmcli can be used for the general functions like to check the status of wired connections for this purpose we used command as:

$ nmcli general status

How to Use nmcli in Ubuntu 5

We can also check the hostname by using this command:

$ nmcli general hostname

How to Use nmcli in Ubuntu 6

We can also check the permissions which are granted by the network manager as

$ nmcli general permissions

How to Use nmcli in Ubuntu 7

Nmcli command for the radio transmission control : We can check the status of the wifi whether it is on or off by the following command:

$ nmcli radio wifi

How to Use nmcli in Ubuntu 8

Nmcli command for monitoring : We can monitor the changes in different aspects like in connectivity state, devices using the nmcli command as:

$ nmcli monitor

How to Use nmcli in Ubuntu 9

If there some modifications made in the backend of network settings it will display them.

nmcli command for network management : We can manage the network setting using the nmcli command. In Ubuntu the configurations with the wireless devices are considered as connections.

We can display all the connections as:

$ nmcli connection show

How to Use nmcli in Ubuntu 10

We can also check the status of device by using the nmcli command:

$ sudo nmcli dev status

How to Use nmcli in Ubuntu 11

For more functions of nmcli command we can type man nmcli and the brief list will be available on Ubuntu:

How to Use nmcli in Ubuntu 12

How to Use nmcli in Ubuntu 13

Conclusion

The nmcli is the tool of the network manager mostly it is present in Ubuntu but in rare cases if it is not present then no need to panic we can still have it by installing the network manager package. In this write-up, we discussed the nmcli command and its functions briefly. Using the nmcli command we can check out the statuses of the wireless connections. We can also take a look at all the commands of nmcli by opening its manual through the “man” command. I Expect this writeup will make you understand the use of nmcli command.

Leave a Comment

Your email address will not be published. Required fields are marked *