Working on a Linux machine without a graphical desktop? You can still get online. The nmcli connect to Wi-Fi method lets you join wireless networks straight from your terminal without any graphical tools. Nmcli is a terminal-based client for NetworkManager, which ships pre-installed on most Linux distributions. All you need is your network name (SSID) and its password.

Check Your Wireless Device Status

Before you run any nmcli connect to Wi-Fi command, confirm your wireless adapter is visible to the system. Run this:

nmcli dev status

You’ll see a table listing every network device on your machine. The columns you care about:

ColumnWhat it shows
DEVICEAdapter name (e.g., wlan0, wlp2s0)
TYPEwifi, ethernet, loopback, etc.
STATEconnected, disconnected, or unavailable
CONNECTIONActive network name, if any

Enable the Wireless Radio

Check whether your Wi-Fi radio is on or off:

nmcli radio wifi

If the output reads disabled, switch it on before you do anything else:

nmcli radio wifi on

Scan for Available Networks

Once the radio is on, scan for nearby access points:

nmcli dev wifi list

This lists every network your adapter can see, along with signal strength and security type. Note the SSID you want to join.

FieldMeaning
SSIDWireless network name
SIGNALStrength as a percentage
SECURITYEncryption type (WPA2, WPA3, WEP, or open)

Connect Using nmcli connect to Wi-Fi

Use this single command to join a network:

sudo nmcli dev wifi connect YOUR_SSID password "YOUR_PASSWORD"

Replace YOUR_SSID and YOUR_PASSWORD with your actual values. If your SSID has spaces, wrap it in quotes.

To avoid typing your password in plain text, add --ask:

sudo nmcli --ask dev wifi connect YOUR_SSID

NetworkManager prompts you to enter credentials privately. Once you’re connected, ping a public address to confirm the connection is live:

ping -c 4 google.com

A successful reply confirms you’re online. NetworkManager saves this profile automatically, so your machine will rejoin the same network after a reboot without any extra steps.

Manage Saved Network Profiles

Over time your system collects multiple saved profiles. To list them all:

nmcli con show

Each profile has a UUID, which you can use alongside the SSID name to switch or disconnect. This matters on machines that move between locations.

ActionCommand
Disconnectnmcli con down SSID_OR_UUID
Reconnectnmcli con up SSID_OR_UUID
List profilesnmcli con show
Delete profilenmcli con delete SSID_OR_UUID

If you need to confirm the IP address assigned to your device after connecting, use ip addr show to see the full interface details.

FAQs

Does nmcli work without NetworkManager installed?

No. Nmcli is the command-line client for NetworkManager. If NetworkManager is not installed or not running, nmcli commands will fail. Install and start it first using your distribution’s package manager.

How do I connect to a hidden Wi-Fi network with nmcli?

Use the hidden yes flag: sudo nmcli dev wifi connect YOUR_SSID password "PASSWORD" hidden yes. This forces a directed probe for the SSID rather than relying on beacon broadcasts.

Why does nmcli say “No network with SSID found”?

The access point may be out of range or the scan list is stale. Run nmcli dev wifi rescan, wait a few seconds, then retry nmcli dev wifi list before connecting again.

Can I use nmcli to connect to Wi-Fi without sudo?

You can if your user has the correct PolicyKit permissions. By default, most distros require sudo for activating connections. Check your system’s NetworkManager policy configuration to adjust this.

How do I stop a network from auto-connecting on boot?

Run nmcli con modify YOUR_SSID connection.autoconnect no. This keeps the profile saved but prevents automatic reconnection when the system starts or the interface comes up.

Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.