how to use nmtui linux

Configuring IP Networking with nmtui on Linux

There are several Linux command-line utilities for managing networks, including nmtui. Despite running on the command line, this utility provides a user-friendly, text-based interface for network management. In this post, I will provide a comprehensive guide on how to use nmtui like a pro.

nmtui is a text-based user interface for managing network connections in Linux. It is part of the NetworkManager package used to manage network connections on Linux.

Check the table of contents below to find what you’re looking for, or continue reading to get a full overview of the nmtui command.

Want the best experience? Become a premium member for ad-free browsing, access exclusive content, and ask questions in our private forums. Your membership helps support the site!
Linux doesn’t have to be intimidating. With my e-book, Master Linux Commands, you’ll uncover the secrets of the terminal in a fun, step-by-step journey. From basics to scripts, get ready to level up your Linux skills. Oh, and did I mention the handy cheat sheet you get as a bonus?

Network Manager: Brief introduction

I used the term “NetworkManager” in my introduction. Let me give you a quick overview of what it is, as I may refer to it regularly in my other tutorials.

The sole purpose of the Network Manager is to manage network connections on Linux. It offers features like automatically detecting and connecting to a network (Wi-Fi) connection, creating network profiles, network security and encryption, etc.

Another interesting feature of the Network Manager is its tools for configuring system networking. These tools provide various interfaces, from command-line utilities to graphical user interfaces. Here are some of the most commonly used ones:

  • nmcli
  • nmtui
  • GNOME Control Center (Network Settings)
  • KDE Plasma Network Management

In this article, I will focus only on nmtui. Features that you may miss in nmtui may be available in nmcli. If you are new to Linux commands, I would suggest starting with nmtui because of these three main features:

  • Text-based user interface:
    • It operates within the terminal.
    • It’s suitable for non-graphical environments such as servers or SSH connections.
  • Menu-driven navigation:
    • Easy navigation using keyboard keys (arrow and tab keys).
  • Simplicity and user-friendliness:
    • Straightforward setup and configuration. Even if you are new to Linux, using nmtui shouldn’t be hard.

Installing nmtui

Since the NetworkManager comes pre-installed in most Linux distributions, nmtui also comes pre-installed. The simplest way to check whether nmtui is installed is to run any of the commands below.

which nmtui
nmtui

If you don’t get any output, then nmtui is not installed. Go ahead and install it using any of the commands below depending on your Linux distribution.

  • Ubuntu/Debian:
    sudo apt update
    sudo apt install network-manager
  • Fedora:
    sudo dnf install NetworkManager-tui
  • CentOS/RHEL:
    sudo yum install NetworkManager-tui
  • Arch Linux:
    sudo pacman -S networkmanager
  • openSUSE:
    sudo zypper install NetworkManager-tui

If you’re new to the Linux command line, this article will give you the most important Linux commands to know, plus a free downloadable cheat sheet to keep handy.

Usage Examples

Up to this point, you understand nmtui and have learnt how to install it on your Linux system. To get started with nmtui, launch your Terminal and execute the command below:

nmtui

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

You should see an interface similar to the image below pop-up on your Terminal. This is what we refer to as a text-based interface. That means you can navigate through the various options using your keyboard.

Now, let us look at some things you can achieve with nmtui.

Connect or disconnect a Wi-Fi network

Use the arrow keys on your keyboard to select the “Activate a connection” option as shown below.

Press “Enter.” Here you will see available options for connecting to a network supported by your PC. That includes both wired and wireless. In my case, my PC supports two Wi-Fi cards and Ethernet.

Select a Wi-Fi network you want to connect to and hit “Enter.” You will see a pop-up message saying “connecting…” If the Wi-Fi network is protected, you will see a prompt to enter the Wi-Fi password.

Alternatively, if you were already connected to a network, you can disconnect by using the arrow keys to select the network and hit “Enter.” You will see a message saying “disconnecting…“.

Creating new connections

Another interesting thing you can do with nmtui is “Create a new connection.”

The purpose of creating a new connection profile is to configure and save the settings required to connect to a specific network. It can be wireless (Wi-Fi) or wired (Ethernet).

This new connection will have network details like the network interface to use, SSID for Wi-Fi, the internet protocol to use (IPV4 or IPV6) and much more. Therefore, when you select this new connection, it will automatically connect your system to a network.

Follow the steps below to learn how to create a new network connection in nmtui.

  • Select “Edit a Connection” in the nmtui interface and hit “Enter.”
  • On the next screen, you will see several network options including wired for Ethernet and Wi-Fi. Select any network option and hit the tab key to select the “Add” option. Hit “Enter.”
  • You will see a screen with a prompt to select the type of connection you wish to create. Now there are several options:
    • Ethernet
    • InfiniBand: Commonly used in high-performance computing (HPC) environments and data centres.
    • Wi-Fi
    • Bond: Used to combine multiple network interfaces into a single logical interface for increased bandwidth and redundancy.
      In our case, stick to Wi-Fi or Ethernet. For this post, I will show you how to add a wired and a wireless connection.

Add a wired connection (Ethernet)

Follow the steps below to add a wired connection.

  • Select “Ethernet” as shown above and hit “Enter.”
  • There are two fields that you will need to fill in here:

    Profile name: The wired connection’s name, which can be anything.
    Device: The network interface you want to use for this connection. This is typically something like “eth0” or “enp0s3” for Wi-Fi devices.

    If you are not sure about the network interfaces available on your system, open another terminal window/ tab and execute any of the commands below.

    ip link
    ifconfig

  • Use the arrow keys to scroll to the bottom and select “OK.” Hit “Enter.” That’s it. You have successfully added a new wired connection.

Add a wireless connection (Wi-Fi)

Follow the steps below to add a wireless connection.

  • On the “Select type of connection” screen, select Wi-Fi and hit “Enter.”
  • You will see a new screen where you will need to fill in the connection details. There are so many fields but focus on these three. The rest are optional and you can leave them as default.
    • Profile name: Set the name of your new wireless connection. It can be any name but try to make it short and readable.
    • Device: The network interface you want to use for this connection. This is typically something like wlan0 or wlp2s0 for Wi-Fi devices.
    • SSID: The Service Set Identifier, or the name of the Wi-Fi network you want to connect to.
    • Security: If the Wi-Fi network you want to connect to doesn’t have a password, you can leave this a “none.” However, if it is password protected, hit the “Enter” key and select the mode of security configuration used:
      • None
      • WPA & WPA2 Personal
      • WPA3 Personal
      • WPA & WPA2 Enterprise
      • LEAP
      • Enhanced Open (OWE)
    • Password: This is the password of the Wi-Fi that you want to connect to. That’s if it is password protected.

Once done, use the arrow keys to scroll to the bottom and select OK. Hit “Enter.”

View and edit network configurations

You can also use nmtui to view and edit existing network configurations. For example, maybe the Wi-Fi password has changed and you need to enter the new password, or you want to change the network protocol from IPv4 to IPv6 and vice versa.

To get started, launch nmtui from the terminal as shown below:
nmtui

Select the “Edit a Connection” option and hit “Enter.”

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

On the screen that appears, select the network that you want to edit or view configurations and hit “Enter.” In my case, I will select my Wi-Fi network.

You will see a screen displaying the details about your network. You can decide to edit them or leave them as they are.

Deleting connections

If you had created some network connections and you no longer need them, launch nmtui, select “Edit a connection” -> select the network connection that you want to delete and then use the “arrow keys” to select “Delete.” Hit “Enter” to remove the connection.

Tips

Even though nmtui provides an interactive text-based interface, it supports several commands you can execute directly on the terminal. Let’s have a look at them.

  • nmtui connect:
    This command allows you to connect to a specific network directly using parameters such as the network’s name, UUID, device, or SSID.
    nmtui connect [name|UUID|device|SSID]
    e.g
    nmtui connect wifi1
  • nmtui edit:
    nmtui edit [name|UUID|device|SSID]
    e.g
    nmtui edit wifi1

    This command will open the “edit configuration” screen for the network that you want to edit or view configurations.
  • nmtui hostname:
    This command allows you to change or edit the system’s hostname. You will need to execute this command using elevated privileges.
    sudo nmtui hostname [new_hostname]
    e.g
    sudo nmtui hostname RaspberryTips

nmtui alternatives

While nmtui provides a convenient text-based interface for managing network connections, it has several limitations:

  • Limited Advanced Features: The NetworkManager has many advanced features you cannot interact with using nmtui.
  • User Interface Constraints: As a text-based interface, it may not be as intuitive or visually appealing as graphical interfaces.
  • Not Scriptable: This is one of the major drawbacks for many advanced Linux users. nmtui cannot be easily used in scripts or automated tasks since most of its features are available n the text-based interface.

There are several nmtui alternatives offering different interfaces and functionalities:

  • nmcli: nmcli is a powerful command-line tool for NetworkManager that supports more advanced features than nmtui. The best thing I like about nmcli is that you can integrate it into your scripts.
  • GNOME Network Manager Applet: This is a graphical user interface for managing network connections in the GNOME desktop environment. If you are on Debian or Ubuntu, I am pretty sure you have integrated with it.
  • KDE Plasma Network Management: This is the default network management tool for users who love the KDE Plasma Desktop Environment.
Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

Related Questions

How to edit VPN connections with nmtui?

According to Redhat documentation on the nmtui utility, “nmtui does not support all types of connections. In particular, you cannot edit VPNs, wireless network connections using WPA Enterprise, or Ethernet connections using 802.1X.”

How can you set a static IP address using nmtui?

By default, nmtui sets the network to use DHCP, which means your system is automatically assigned an IP address. To enable static IP addressing, launch nmtui -> navigate to “Edit a Connection” and select the network for which you want to set a static IP address.

In the connection settings, scroll down to “IPv4 CONFIGURATION” and change it from “Automatic” to “Manual.” Click on “Show” to expand the settings, and enter the desired IP address, netmask, gateway, and DNS servers.

I explain this in more detail in this article: 3 Easy Ways To Set A Static IP Address On Raspberry Pi.

If you have any other questions or doubts about on using nmtui, please refer to the RedHat documentation, which is quite extensive on the subject (link here).

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Want to chat with other Raspberry Pi enthusiasts? Join the community, share your current projects and ask for help directly in the forums.

Additional Resources

Overwhelmed with Linux commands?
My e-book, “Master Linux Commands”, is your essential guide to mastering the terminal. Get practical tips, real-world examples, and a bonus cheat sheet to keep by your side.
Grab your copy now.

VIP Community
If you just want to hang out with me and other Linux fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.

Need help building something with Python?
Python is a great language to get started with programming on any Linux computer.
Learn the essentials, step-by-step, without losing time understanding useless concepts.
Get the e-book now.

How would you rate this article?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Spread the word!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Similar Posts