‘nmtui’ Linux Command | What is it and Usage Guide

Network configuration panel with symbolic tools and cables representing the nmtui command linux

Don’t you wish configuring network interfaces could be easier? At IOFLOOD, efficient network connectivity is integral to our dedicated hosting services, and understanding network management is crucial. During our time, we have found nmtui, or NetworkManager Text User Interface, provides a user-friendly interface for configuring network settings, making it accessible even to those less familiar with command-line interfaces. To empower our customers and fellow developers on the utility of nmtui in Linux network administration, we present today’s article, filled with practical insights and step-by-step instructions.

This guide will walk you through the ins and outs of the nmtui command, from basic use to advanced techniques. We’ll cover everything from launching the NetworkManager’s text user interface to managing specific network connections and setting up a VPN.

So, let’s dive in and start mastering the nmtui command in Linux!

TL;DR: What is the nmtui command in Linux?

The nmtui (Network Manager Text User Interface) command is a user-friendly text interface for managing your network settings in Linux. You can start it with nmtui and exit it with, nmtui-quit.

Here’s a simple usage example:

nmtui

# Output:
# NetworkManager TUI

This command will open the NetworkManager’s text user interface, presenting you with a menu to manage your network connections.

In this example, we’ve used the nmtui command to launch the NetworkManager’s text user interface. This interface provides a user-friendly way to manage network settings in Linux.

This is just a basic way to use the nmtui command in Linux, but there’s much more to learn about managing network settings efficiently. Continue reading for more detailed information and advanced usage scenarios.

Getting Started with nmtui

To start using the nmtui command in Linux, you’ll first need to open the terminal. Once your terminal is open, you can begin managing your network settings.

Launching the Network Manager

To launch the Network Manager, you can use the nmtui command. This will open up the Network Manager’s Text User Interface.

nmtui

# Output:
# ┌─┤ NetworkManager TUI ├───────────────────────────────────────────────────┐
# │                                                                              │
# │          Please select an option from the below menu:                        │
# │                                                                              │
# │                  Edit a connection                                           │
# │                  Activate a connection                                       │
# │                  Set system hostname                                         │
# │                                                                              │
# │                                                                              │
# │                                                                              │
# │                                                                              │
# │                                                                              │
# │                   Quit                                                       │
# │                                                                              │
# └──────────────────────────────────────────────────────────────────────────────┘

This will bring up a menu with several options, including ‘Edit a connection’, ‘Activate a connection’, and ‘Set system hostname’. You can navigate through this menu using the arrow keys and make a selection using the Enter key.

Editing a Connection

To edit a network connection, you can select the ‘Edit a connection’ option. This will bring up a list of all your network connections. You can select a connection to edit by navigating to it using the arrow keys and pressing Enter.

nmtui edit Wired connection 1

# Output:
# ┌─┤ NetworkManager TUI ├───────────────────────────────────────────────────┐
# │                                                                              │
# │       Please specify the details of the connection:                           │
# │                                                                              │
# │                  Profile name: Wired connection 1                             │
# │                  Device: ens33                                               │
# │                                                                              │
# │                   IPv4 CONFIGURATION                                         │
# │                   IPv6 CONFIGURATION                                         │
# │                   [ ] Automatically connect                                   │
# │                   [ ] All users may connect                                   │
# │                                                                              │
# │                                                                              │
# │                   <Back                                                      │
# │                   OK                                                         │
# │                   Cancel                                                     │
# │                                                                              │
# └──────────────────────────────────────────────────────────────────────────────┘

In this example, we’ve edited the ‘Wired connection 1’ network connection. The interface provides several options for configuring this connection, including setting the IPv4 and IPv6 configurations and deciding whether the connection should automatically connect.

This is just the beginning of what you can do with the nmtui command in Linux. As you explore further, you’ll find that this command is a powerful tool for managing your network settings.

Advanced Features: nmtui Command

As you become more comfortable with the basic usage of the nmtui command, you can start to explore its more advanced features. These include managing specific network connections and setting up a VPN. But before we get started, let’s get familiar with some of the command-line arguments or options that can modify the behavior of the nmtui command.

Here’s a quick reference table of some of the most commonly used options with the nmtui command in Linux:

OptionDescriptionExample
editEdit a specific network connection.nmtui edit 'Wired connection 1'
connectActivate a specific network connection.nmtui connect 'Wired connection 1'
hostnameChange the system hostname.nmtui hostname 'myhost'

Remember, using these options can make the nmtui command even more powerful and flexible. They can help you manage your network settings more efficiently.

Now that we’ve covered that, let’s delve into these features in more detail.

Managing Specific Network Connections

To manage a specific network connection, you can use the edit option followed by the name of the connection. This allows you to directly edit the settings of a specific connection.

nmtui edit 'Wired connection 1'

# Output:
# NetworkManager TUI - Edit connection

In this example, we’ve edited the ‘Wired connection 1’ network connection. The interface provides several options for configuring this connection, including setting the IPv4 and IPv6 configurations and deciding whether the connection should automatically connect.

Activating a Network Connection

To activate a network connection, you can use the connect option followed by the name of the connection. This allows you to quickly activate a specific connection.

nmtui connect 'Wired connection 1'

# Output:
# NetworkManager TUI - Activate connection

In this example, we’ve activated the ‘Wired connection 1’ network connection. The interface confirms the activation of the connection.

Changing the System Hostname

To change the system hostname, you can use the hostname option followed by the new hostname. This allows you to quickly change the system hostname.

nmtui hostname 'myhost'

# Output:
# NetworkManager TUI - Set system hostname

In this example, we’ve changed the system hostname to ‘myhost’. The interface confirms the change of the system hostname.

These are just a few examples of the advanced usage of the nmtui command in Linux. As you explore further, you’ll find that this command is a powerful tool for managing your network settings.

Alternate Network Management Tools

While the nmtui command is a powerful tool for managing network settings in Linux, it’s not the only one. There are other commands and tools that you can use to manage your network settings. Two of the most popular alternatives are the nmcli command and network scripts.

Harnessing the Power of nmcli

The nmcli command is a command-line client for NetworkManager. It’s more versatile than nmtui and allows for more granular control over network settings.

Here’s an example of how to use the nmcli command to display the status of all network connections:

nmcli con show

# Output:
# NAME                UUID                                  TYPE      DEVICE
# Wired connection 1  1b8f45cb-8a2a-4a0e-9a5d-038e0b6bcb8b  ethernet  ens33

In this example, the nmcli con show command displays a list of all network connections, including their names, UUIDs, types, and associated devices.

Leveraging Network Scripts

Network scripts, also known as ifup/ifdown scripts, are another way to manage network settings in Linux. These scripts allow for more complex network configurations and are often used in server environments.

Here’s an example of how to use a network script to bring up a network interface:

sudo ifup ens33

# Output:
# Internet Systems Consortium DHCP Client 4.3.5
# Copyright 2004-2016 Internet Systems Consortium.
# All rights reserved.
# For info, please visit https://www.isc.org/software/dhcp/

# Listening on LPF/ens33/00:0c:29:28:fd:4c
# Sending on   LPF/ens33/00:0c:29:28:fd:4c
# Sending on   Socket/fallback
# DHCPDISCOVER on ens33 to 255.255.255.255 port 67 interval 3 (xid=0x4d3c8f1d)
# DHCPREQUEST of 192.168.1.6 on ens33 to 255.255.255.255 port 67 (xid=0x1d8f3c4d)
# DHCPOFFER of 192.168.1.6 from 192.168.1.1
# DHCPACK of 192.168.1.6 from 192.168.1.1
# bound to 192.168.1.6 -- renewal in 1597 seconds.

In this example, the sudo ifup ens33 command brings up the ‘ens33’ network interface. The output displays the DHCP negotiation process, culminating in the interface being assigned an IP address.

When comparing these methods, it’s important to consider their pros and cons. While the nmtui command is user-friendly and straightforward, it doesn’t offer as much granularity as the nmcli command or network scripts. On the other hand, while the nmcli command and network scripts allow for more complex configurations, they can be more challenging to use, especially for beginners.

Ultimately, the best tool for managing network settings in Linux depends on your specific needs and level of expertise.

Troubleshooting: Linux nmtui

As with any tool, there can be times when using the nmtui command in Linux might not go as smoothly as planned. But don’t worry, we’ve got you covered. Here are some common issues you might encounter and their solutions.

NetworkManager is Not Running

If you try to run the nmtui command and encounter an error message that says ‘NetworkManager is not running’, it means that the NetworkManager service is not currently active on your system. You can start it using the following command:

sudo systemctl start NetworkManager

# Output:
# [sudo] password for user: 

In this example, the sudo systemctl start NetworkManager command starts the NetworkManager service. You’ll be prompted to enter your password, as this command requires superuser privileges.

Connection Activation Failed

If you try to activate a network connection using the nmtui command and see a ‘Connection activation failed’ error message, it could be due to a variety of reasons, such as incorrect network settings or hardware issues.

To troubleshoot this, you can check the status of your network interfaces using the following command:

nmcli device status

# Output:
# DEVICE  TYPE      STATE      CONNECTION 
# ens33   ethernet  connected  Wired connection 1 
# lo      loopback  unmanaged  --

In this example, the nmcli device status command displays the status of all network interfaces. The ‘STATE’ column shows whether each interface is connected, disconnected, or unmanaged.

Tips for Best Practices

When using the nmtui command in Linux, here are some tips for best practices:

  • Always check the status of the NetworkManager service before running the nmtui command. This can help you avoid errors related to the NetworkManager not running.

  • When editing a network connection, make sure to save your changes before exiting the interface. If you don’t, your changes will not be applied.

  • If you’re having trouble with a network connection, try deactivating and then reactivating it. This can often resolve minor issues.

Remember, troubleshooting is a normal part of working with any command in Linux. The key is to understand the error messages you encounter and know how to resolve them.

The role of NetworkManager in Linux

The nmtui command in Linux is part of a larger system known as NetworkManager. NetworkManager is a dynamic network control and configuration system that aims to keep network devices and connections up and active when they’re available.

NetworkManager: The Backbone of nmtui

NetworkManager is a daemon that sits in the background and handles our network interfaces. It’s responsible for managing network connections, keeping track of networks you’re connected to, and even storing network settings for future use.

NetworkManager can control Ethernet, Wi-Fi, mobile broadband, and many other types of network interfaces. It uses a variety of methods to do this, including standard Linux commands, scripts, and even direct manipulation of the Linux kernel.

The nmtui command is a text-based interface to NetworkManager. It allows you to interact with NetworkManager directly from the command line, making it a powerful tool for managing network settings in Linux.

Here’s an example of how you can use the nmtui command to interact with NetworkManager:

nmtui

# Output:
# NetworkManager TUI

In this example, the nmtui command launches the NetworkManager’s Text User Interface, allowing you to manage network settings directly from the command line.

The Importance of Network Management in Linux

Network management in Linux is crucial for many reasons. It allows you to control how your system communicates with other systems on the network, ensuring that your system can send and receive data efficiently and securely.

Whether you’re a system administrator managing a large network of Linux servers, or a regular user setting up a home network, understanding how to manage network settings in Linux is a valuable skill.

The nmtui command in Linux, as part of the NetworkManager system, is a powerful tool for network management. By mastering this command, you can take control of your network settings and ensure your system communicates effectively with the network.

Practical Usage Cases of nmtui

The nmtui command in Linux is not just a theoretical tool. It has practical applications in real-world scenarios, from setting up a home network to managing a server. Let’s explore some of these scenarios in more detail.

Setting Up a Home Network with nmtui

If you’re setting up a home network, the nmtui command can be a great asset. It allows you to manage your network settings directly from the command line, giving you a high level of control over your network configuration.

For instance, you can use the nmtui command to set up a static IP for your home server. Here’s how you can do it:

nmtui edit 'Wired connection 1'

# In the IPv4 CONFIGURATION section, change the 'Method' to 'Manual'
# Add a new address, netmask and gateway
# Save the changes

In this example, we’ve used the nmtui command to set a static IP for the ‘Wired connection 1’. This can be useful if you want to ensure that your home server always has the same IP address.

Managing a Server with nmtui

If you’re a system administrator managing a Linux server, the nmtui command can be an invaluable tool. It allows you to manage network settings quickly and efficiently, without the need for a graphical user interface.

For instance, you can use the nmtui command to quickly switch between different network profiles. Here’s an example:

nmtui connect 'Profile 1'

# Output:
# NetworkManager TUI - Activate connection

In this example, we’ve used the nmtui command to switch to ‘Profile 1’. This can be useful if you have different network profiles for different tasks or environments.

Further Resources for Mastering nmtui Command

To dive deeper into the nmtui command and network management in Linux, here are some additional resources you might find useful:

  1. The Official Red Hat Enterprise Linux 7 Networking Guide provides in-depth information on network management in Linux, including the use of the nmtui command.

  2. The Arch Linux Wiki’s NetworkManager page offers a comprehensive guide to NetworkManager, the system that powers the nmtui command.

  3. The Fedora Project’s Network Manager Guide provides detailed instructions on managing network settings in Linux.

By exploring these resources and practicing with the nmtui command, you can become a master of network management in Linux.

Recap: nmtui Command Mastery

In this comprehensive guide, we’ve journeyed through the intricacies of the nmtui command in Linux, a versatile tool for managing network settings.

We began with the basics, understanding how to use the nmtui command to manage network settings and exploring a step-by-step guide with code examples and explanations of the output. We then ventured into more advanced territory, discussing more complex uses of the nmtui command, such as managing specific network connections or setting up a VPN.

Along the way, we tackled common issues you might face when using the nmtui command and provided solutions to help you overcome these challenges. We also looked at alternative approaches to network management in Linux, comparing the nmtui command with other tools such as nmcli and network scripts.

Here’s a quick comparison of these methods:

MethodUser-FriendlinessGranularity of Control
nmtuiHighModerate
nmcliModerateHigh
Network ScriptsLowHigh

Whether you’re just starting out with network management in Linux or you’re looking to level up your skills, we hope this guide has given you a deeper understanding of the nmtui command and its capabilities.

With its balance of user-friendliness and control, the nmtui command is a powerful tool for network management in Linux. Now, you’re well equipped to manage your network settings efficiently and effectively. Happy networking!