How to Connect to a Hidden Wi-Fi Network in Ubuntu Terminal

Connecting to a Wi-Fi network that broadcasts its SSID (Service Set Identifier) is simple in Ubuntu. However, for security or privacy reasons, many enterprise and private networks choose to hide their SSID. This means the network will not appear in the standard drop-down list of available connections.

While you can use the graphical interface to manually type the network details, doing this via the terminal using the NetworkManager command-line tool (nmcli) is often faster, more reliable, and essential if you are working on a headless server without a desktop environment.

This guide explains how to connect to a hidden Wi-Fi network securely using the Ubuntu terminal.

Step 1: Verify Your Wireless Interface

Before you can connect to any network, you need to know the name of your wireless interface card. In older versions of Linux, this was almost always wlan0, but modern Ubuntu versions use more complex naming conventions based on hardware locations (such as wlp2s0 or wlo1).

To find your interface name, open your terminal and run:

ip link

Look through the output for an interface starting with wl or wlan. Alternatively, you can use the NetworkManager specific command to see the status of all network devices:

nmcli device status

Note down the exact name of the device listed as “wifi”.

Step 2: Check if Wi-Fi is Enabled

Ensure that your computer’s Wi-Fi radio is actually turned on. You can check the hardware and software status of your wireless adapters using the rfkill command:

rfkill list all

If the Wi-Fi is “Soft blocked”, you can enable it by running:

sudo rfkill unblock wifi

Next, ensure NetworkManager has the Wi-Fi feature enabled by running:

nmcli radio wifi on

Step 3: Connect to the Hidden Network

To connect to a hidden network, you must tell NetworkManager explicitly that the SSID is hidden, so it actively probes for it instead of passively listening.

Use the following nmcli command structure to create a new connection profile and connect simultaneously. Replace YOUR_SSID with the exact name of the hidden network, and YOUR_PASSWORD with the Wi-Fi password.

nmcli device wifi connect "YOUR_SSID" password "YOUR_PASSWORD" hidden yes

The system will attempt to authenticate. If successful, you will see a message confirming the connection: Device 'wlp2s0' successfully activated with 'UUID'.

Step 4: Managing the Connection for the Future

Once you connect successfully, Ubuntu saves this configuration as a permanent network profile. The next time you are in range, Ubuntu will automatically probe for the hidden network and connect to it.

If you ever need to disconnect from the network manually, you can bring the connection down using:

nmcli connection down "YOUR_SSID"

If you want to forget the network entirely so your computer stops broadcasting probes for it, you can delete the saved profile with:

nmcli connection delete "YOUR_SSID"

By mastering the nmcli tool, you can manage complex wireless configurations on any Ubuntu machine, regardless of whether a graphical interface is available.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.