The nmtui Command and Utility on Linux

The nmtui utility provides a curses-based application for managing Ethernet cards and connections. A connection is a collection of settings the Ethernet card needs to connect to the network. The following command starts the nmtui utility.

#nmtui

The nmtui command

The first screen has the following three options.

Edit a connection: - This option allows us to add a new connection and manage existing connections.

Activate a connection: - This option allows us to activate or deactivate a connection on an interface.

Set system hostname: - This option allows us to change or set the hostname.

The Tab and Arrow keys allow us to move between the options. Each option has a sub-screen that we can access by pressing the Enter key. We can also access the sub-screen of these options directly from the command line.

The nmtui-edit command opens the sub-screen of the first option.

#nmtui-edit

The nmtui-edit command

Use the nmtui-connect command to access the second option's sub-screen.

#nmtui-connect

The nmtui connect

Use the nmtui-hostname command to access the third option's sub-screen.

#nmtui-hostname

The nmtui-hostname command

Whether you use the first screen of the nmtui utility or the related command to access the sub-screen of an option, the settings available on the sub-screen are the same. The commands mentioned above only bypass the first screen of the nmtui command. From the sub-screen of an option, we can manage all settings related to the option.

Let's take an example to understand how to use each option and its settings. In this example, we will perform the following activities.

  • Creating a new connection
  • Activating the connection
  • Changing the hostname
  • Verifying the changes
  • Deleting the created connection

The nmtui command examples

Select the first option (Edit a connection) on the first screen and press Enter.

Editing a connection

The next screen displays existing connections on the left side. On the right side, it shows options for managing them. Select the Add option from the right side to add a new connection, and press Enter.

Adding a new connection

The next screen presents all available types of network interfaces. Select the interface type matching the connection. You can make a connection for any network interface. However, you can use that connection only if that interface exists on the system. For example, you created a connection for an Ethernet interface. You can use this connection only if the system has an Ethernet card.

Select the Ethernet and use the Tab key to select the Create option. After selecting the Create option, press the Enter key.

Type of interfaces

The next screen allows us to customize the connection.

Set the Profile name to CustomCon1, IPv4 Configuration to Manual, IPv4 address to 10.0.0.10/8, and Automatically connect option to No.

Default edit screen

To navigate between the options, use the Tab key. Use the Enter key to show the sub-options of the selected option. Use the Space key to toggle the state of checkboxes.

After updating all settings, select the OK button and press the Enter key.

New connection settings

The nmtui utility creates a new connection with specified settings and adds it to the list of connections. By default, it does not activate the new connection.

To activate the new connection, select Back and press the Enter key.

New connection added

On the first screen, select the second option, Activate a connection, select OK, and press the Enter key.

Activate a connection

Select the recently added connection, move to the Activate option, and press the Enter key. Then, move to the Back option, and Press Enter.

Activate a connection

So far, we have added a new connection and have made it active. Now, let's change the hostname. To change the hostname, select the Set system hostname option, move to OK, and press Enter.

Setting a hostname option

Change the hostname, select OK, and press the Enter key.

Changing hostname

Press the Enter key to confirm the change. On the first screen, select the Quit option and press the Enter key.

Applying change

To verify the changes, we can use the ip addr show [interface name] command. This command displays the specified device's current IP configuration.

The ip addr show command

To view the connections, we can use the nmcli con show command. This command lists all connections. If a connection is active on an interface, the output displays the interface's name in the device section.

The nmcli con show

We can use the hostname command to verify the hostname.

The hostname command

To delete a connection, open the nmtui utility, select the Edit a connection option, and press Enter.

Edit a connection

Select the connection you want to delete, move to the Delete option, press the Enter key, Select the Delete option, and press the Enter key to confirm the delete operation.

Delete a connection

Quit from the nmtui utility.

Quit from nmtui

Key points

  • The nmtui utility is part of the NetworkManager package.
  • The NetworkManager provides the default network service on Linux.
  • The NetworkManager offers three tools to manage NICs and connections. These tools are the nmcli, nmtui, and nm-connection-editor.
  • The nmtui utility provides a curses-based application to manage connections. It does not need a GUI environment to run. You can run it on CLI.

ComputerNetworkingNotes Linux Tutorials The nmtui Command and Utility on Linux

We do not accept any kind of Guest Post. Except Guest post submission, for any other query (such as adverting opportunity, product advertisement, feedback, suggestion, error reporting and technical issue) or simply just say to hello mail us ComputerNetworkingNotes@gmail.com