Abstract
This article aims at recording how to connect to Wi-Fi in terminal command without GUI settings.
Note: Though this is for Ubuntu 16.04.6, it may still adapt to the similar version like Ubuntu 18.04.
Step 1. Restart network-manager service
Restart network-manager service with the following command:
sudo service network-manager restart
Step 2. List available Wi-Fi
sudo nmcli dev wifi
Then the available Wi-Fi will be shown like this:
Step 3. Connect to the Wi-Fi
Connect to the Wi-Fi with the command and format below, we take “eduroam” as an example:
sudo nmcli dev wifi connect 'eduroam' password '12345678' iface wlp3s0
In the example above, eduroam is the SSID of the Wi-Fi, 12345678 is the password, and wlp3s0 is the name of the wireless network device. To check the name of wireless network device, use the command below:
ifconfig
Then the network device will be shown:
It is clear that wlp3s0 is the name of wireless network device.
Step 4. Check the connection status
Use command below to check whether the connection is success or not:
sudo nmcli dev status