How to Use the 'nmtui' Command (with Examples)

How to Use the 'nmtui' Command (with Examples)

The nmtui command is a terminal-based utility provided by NetworkManager, which enables users to manage network connections through a text user interface. NetworkManager is a system service for managing network interfaces, such as Ethernet, Wi-Fi, and mobile broadband devices, especially on Unix-based operating systems. With nmtui, users can navigate through various options using arrow keys, select choices with the Enter key, and efficiently manage network tasks without a graphical user interface.

Use Case 1: Open the User Interface

Code:

nmtui

Motivation:
There are instances where users require an intuitive interface for managing network connections without a graphical interface. For instance, when working on a headless server setup, the nmtui command provides a straightforward way to open the NetworkManager Text User Interface, allowing users to manage network settings easily.

Explanation:
Simply typing nmtui in the terminal and hitting enter will launch the main interface of the NetworkManager’s text user interface. This interface acts as a hub where users can access various network-related options, such as connecting to or editing a network and setting the hostname.

Example Output:
Upon running nmtui, the user is greeted with a menu that includes options to activate a connection, edit a connection, or set the system hostname. Navigation within the interface is performed using keyboard arrows and selections are made using the Enter key.

Use Case 2: List Available Connections and Activate/Deactivate Them

Code:

nmtui connect

Motivation:
Network configurations often need to be adjusted quickly, such as when switching between different networks or troubleshooting connectivity issues. This use case is crucial for users who need to view available network connections and change their activation status without delving deep into configuration files or commands.

Explanation:
With the command nmtui connect, NetworkManager’s text user interface opens a specific section to list all available connections. Within this menu, users have the option to activate or deactivate known network connections. This functionality helps in managing network priorities and operations efficiently, by providing a tactile way to handle network interfaces.

Example Output:
The interface displays all network connections along with an indication of their current status (active or inactive). Users can select any connection to either enable or disable it, improving control over which networks the system interacts with at any point in time.

Use Case 3: Connect to a Given Network

Code:

nmtui connect name|uuid|device|SSID

Motivation:
Connecting explicitly to a specific network is essential when dealing with environments with multiple networks available. This is particularly useful for systems administrators or users managing connections in a corporate network where several SSIDs could be in range.

Explanation:
The command nmtui connect name|uuid|device|SSID is used to directly connect to a specific network by providing one of its identifiers. The name refers to the user-assigned connection name, uuid is the universally unique identifier for the network, device pertains to the network interface being used, and SSID is the network’s unique service set identifier (for Wi-Fi networks).

Example Output:
Upon executing this command with an appropriate network identifier, the terminal interface will attempt to establish a connection to the specified network. A message confirming the successful connection, or an error message indicating issues in connecting, will be displayed.

Use Case 4: Edit/Add/Delete a Given Network

Code:

nmtui edit name|id

Motivation:
Configuration management becomes an easy task with the option to modify network settings or add new ones quickly. This is highly valuable in environments that require frequent updates to network configurations due to changing demands or security protocols.

Explanation:
The nmtui edit name|id command invokes a user-friendly editor interface for the specified network connection. By providing either the name or the id of the connection, users can access configurations for adjustment or choose to remove existing connections entirely. This functionality is beneficial in tailoring networks settings to specific requirements or keeping the network list tidy by removing unused entries.

Example Output:
Once you run this command, a configuration screen appears where you can modify settings like IP address, DNS, or security protocols for the network. Additionally, options will be present to add a new network configuration or delete an existing one.

Use Case 5: Set the System Hostname

Code:

nmtui hostname

Motivation:
Setting the system hostname is an often necessary step when configuring a new machine or when adapting the setup of existing machinery to fit new network policies or systems. A correct and standardized hostname can facilitate easier device management, especially when dealing with multiple machines in a LAN or a server environment.

Explanation:
The command nmtui hostname opens the hostname configuration window within the NetworkManager text user interface. Here, users can input a new system hostname. A hostname acts as a unique identifier for a device on a network, and changing it can help in aligning with organizational naming conventions or personal preferences.

Example Output:
This command will bring up an interface allowing the user to type in the new hostname. Upon confirmation, the system will apply the new hostname immediately or upon the next reboot, depending on the system configuration.

Conclusion

The nmtui command provides versatile options for effectively managing network connections and settings through a text-based user interface. By utilizing its various subcommands, users can effortlessly open the management interface, list and connect to available networks, edit or delete network entries, and modify the system hostname, all contributing to enhanced system administration capabilities, even in headless environments.

Related Posts

How to Use the Command 'jcal' (with Examples)

How to Use the Command 'jcal' (with Examples)

The ‘jcal’ command is a tool that allows users to display calendar information in the Jalali format, which is the Iranian calendar used officially in Iran and Afghanistan.

Read More
How to Use the Command 'Gammastep' (with Examples)

How to Use the Command 'Gammastep' (with Examples)

Gammastep is an adaptable utility designed to adjust the screen’s color temperature based on the time of day, promoting healthier screen habits and reducing eye strain.

Read More
How to Use the Command 'winicontopam' (with Examples)

How to Use the Command 'winicontopam' (with Examples)

The ‘winicontopam’ command is a utility that belongs to the Netpbm package, designed to convert Windows ICO (icon) files into the PAM (Portable Arbitrary Map) format.

Read More