|
| 1 | +# The `nmtui` Command |
| 2 | + |
| 3 | +The **`nmtui`** (Network Manager Text User Interface) command is a **menu-driven tool** for configuring network connections in Linux. |
| 4 | +It provides a simple, text-based interface to manage network settings such as Wi-Fi, Ethernet, hostname, and more — without using complex command-line options. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +### 🔹 What it Does |
| 9 | + |
| 10 | +`nmtui` allows you to: |
| 11 | +- View and edit **network connections** |
| 12 | +- **Activate or deactivate** interfaces |
| 13 | +- **Set or change** the system **hostname** |
| 14 | +- Connect to **Wi-Fi networks** |
| 15 | +- Manage **IPv4 / IPv6 settings** |
| 16 | + |
| 17 | +It is especially useful on servers or systems **without a graphical desktop environment**. |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +### 🧠 Syntax |
| 22 | + |
| 23 | +nmtui [OPTION] |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +### 🖥️ Examples |
| 28 | + |
| 29 | +1. **Open the main menu interface:** |
| 30 | + |
| 31 | + nmtui |
| 32 | + Opens the main TUI (text user interface) window with options to *Edit a connection*, *Activate a connection*, or *Set system hostname*. |
| 33 | + |
| 34 | +2. **Directly edit a network connection:** |
| 35 | + |
| 36 | + nmtui edit |
| 37 | + Lets you create, modify, or delete network connections (both Ethernet and Wi-Fi). |
| 38 | + |
| 39 | +3. **Directly activate or deactivate connections:** |
| 40 | + |
| 41 | + nmtui connect |
| 42 | + Opens the *Activate a connection* menu where you can enable or disable network interfaces. |
| 43 | + |
| 44 | +4. **Set or change the system hostname:** |
| 45 | + |
| 46 | + nmtui hostname |
| 47 | + Opens a dialog box to set your system’s hostname (used for identification on a network). |
| 48 | + |
| 49 | +5. **Connect directly to a specific Wi-Fi network:** |
| 50 | + |
| 51 | + nmtui connect "MyWiFiNetwork" |
| 52 | + Connects to the specified Wi-Fi network if it exists in range. |
| 53 | + |
| 54 | +6. **Quit the interface:** |
| 55 | + Simply use **Tab → Quit** or press **Esc**. |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +### 🧩 Common Options and Subcommands |
| 60 | + |
| 61 | +| **Command** | **Description** | |
| 62 | +|:-------------|:----------------| |
| 63 | +| `nmtui` | Launches the interactive main menu | |
| 64 | +| `nmtui edit` | Opens the “Edit a connection” screen | |
| 65 | +| `nmtui connect` | Opens the “Activate a connection” screen | |
| 66 | +| `nmtui hostname` | Opens the “Set system hostname” dialog | |
| 67 | +| `nmtui connect <SSID>` | Connects to a specific Wi-Fi network directly | |
| 68 | +| `nmtui help` | Displays basic usage help | |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +### ⚙️ Interface Navigation |
| 73 | + |
| 74 | +- Use the **arrow keys** or **Tab** to move between fields. |
| 75 | +- Press **Enter** to select. |
| 76 | +- Use **Spacebar** to toggle checkboxes or options. |
| 77 | +- Press **Esc** or select **Quit** to exit safely. |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +### 📡 Common Use Cases |
| 82 | + |
| 83 | +**1. Configure a static IP address:** |
| 84 | + |
| 85 | +nmtui edit |
| 86 | +→ Choose your Ethernet connection |
| 87 | +→ Set “IPv4 CONFIGURATION” to *Manual* |
| 88 | +→ Enter IP, Gateway, and DNS |
| 89 | +→ Save → Activate connection |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +**2. Connect to Wi-Fi from terminal:** |
| 94 | + |
| 95 | +nmtui connect |
| 96 | +→ Select your wireless interface |
| 97 | +→ Choose the SSID |
| 98 | +→ Enter the password |
| 99 | +→ Activate connection |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +**3. Change the hostname:** |
| 104 | + |
| 105 | +nmtui hostname |
| 106 | +→ Type your new hostname |
| 107 | +→ Confirm and exit |
| 108 | +→ The new hostname will apply immediately. |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +### 🛠 Troubleshooting |
| 113 | + |
| 114 | +| **Issue** | **Possible Solution** | |
| 115 | +|:-----------|:----------------------| |
| 116 | +| `nmtui` command not found | Install NetworkManager TUI: `sudo apt install network-manager` (Debian/Ubuntu) or `sudo dnf install NetworkManager-tui` (Fedora/RHEL/CentOS) | |
| 117 | +| Changes don’t take effect | Restart NetworkManager: `sudo systemctl restart NetworkManager` | |
| 118 | +| Interface not showing | Ensure your interface is managed by NetworkManager: check `/etc/NetworkManager/NetworkManager.conf` | |
| 119 | +| Wi-Fi missing | Make sure wireless drivers are installed and `nmcli device status` shows the Wi-Fi adapter | |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | +### 🧰 Related Commands |
| 124 | + |
| 125 | +| **Command** | **Purpose** | |
| 126 | +|:-------------|:------------| |
| 127 | +| `nmcli` | Command-line (non-interactive) NetworkManager control | |
| 128 | +| `ip addr` | Show IP addresses of all interfaces | |
| 129 | +| `ifconfig` | (Deprecated) Interface configuration command | |
| 130 | +| `systemctl restart NetworkManager` | Restart NetworkManager service | |
| 131 | +| `hostnamectl` | Manage the system hostname directly | |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +### 🧾 Example: Configuring Ethernet via `nmtui` |
| 136 | + |
| 137 | +sudo nmtui |
| 138 | +→ Select **Edit a connection** |
| 139 | +→ Choose **Wired connection 1** |
| 140 | +→ Set IPv4 to **Manual** |
| 141 | +→ Fill in: |
| 142 | +Address: 192.168.1.50/24 |
| 143 | +Gateway: 192.168.1.1 |
| 144 | +DNS: 8.8.8.8 |
| 145 | +→ Save → Back → **Activate a connection** → Select **Wired connection 1** |
| 146 | + |
| 147 | +✅ Your network connection will now use a static IP. |
| 148 | + |
| 149 | +--- |
| 150 | + |
| 151 | +### 📘 Notes |
| 152 | + |
| 153 | +- Changes made with `nmtui` are persistent across reboots. |
| 154 | +- Requires **NetworkManager** to be active. |
| 155 | +- `nmtui` provides the same functionality as `nmcli` but in a more user-friendly interface. |
| 156 | +- Perfect for **server environments** or **SSH sessions** where GUI tools are unavailable. |
0 commit comments