Ubuntu 16.04 – WPA/WPA2 WiFi network (command line)

Turn interface up

Scan wireless networks

Create password for the SSID:

Connect

Start dhclient

Add default IP: