How to connect to Wi-Fi from the command-line on Debian

Josh Sherman
1 min read
Command-line Interface Debian / Ubuntu

Recently I decided to try to eliminate some unnecessary wires from my home network. One of the offending items was our home server that was hard wired to one of our mesh network routers.

The original thought was that by having the server wired, we’d have a more reliable connected to it. While that may be true, nothing that runs on the server is in dire need of a wired connection.

Since it’s a server, running Debian, without a GUI installed at all, I had to get things moving from the command-line. To do so, I used the NetworkManager command-line utility, aptly named nmcli.

First, run nmcli without any arguments, in an attempt to figure out your wireless card’s name:

% nmcli

wlp59s0: unavailable
        "Intel 6 AX200"
        wifi (iwlwifi), 8E:C3:E8:F7:73:D7, sw disabled, hw, mtu 1500

It will probably spit out a bunch of stuff, but you’ll be looking for a section similar to above, that is currently unavailable. It’s unavailable due to it not being connected to a wireless network.

Connecting to a network was pretty simple, once you know the name of your interface:

% nmcli d wifi connect WIFI_SSID password YOUR_PW ifname YOUR_IFACE

Swap out the bits that are in ALL CAPS with your information, and you should be off to the races!

Join the Conversation

Good stuff? Want more?

Weekly emails about technology, development, and sometimes sauerkraut.

100% Fresh, Grade A Content, Never Spam.

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.

Currently Reading

Parasie Eve

Previous Reads

Buy Me a Coffee Become a Sponsor

Related Articles