This is like a re-post of a question from askubuntu.com. To get to that post, I usually had to google it. So, I’ll post it here so I know where to look for when I need it again.

At work, we use WPA2-Enterprise for wireless connection. To create a new connection on my laptop with wlp3s0 as Wifi device, follow this step:

# nmcli con add type wifi ifname wlp3s0 con-name work-wifi ssid work-ssid
# nmcli con edit id work-wifi
nmcli> set ipv4.method auto
nmcli> set 802-1x.eap peap
nmcli> set 802-1x.phase2-auth mschapv2
nmcli> set 802-1x.identity myusername
nmcli> set 802-1x.password mypassword
nmcli> set wifi-sec.key-mgmt wpa-eap
nmcli> save
nmcli> activate

That’s it if you know how to do it.

Credit: Connect to a WPA2-Enterprise Connection via CLI (no desktop)