Android: connect to Wifi using terminal

4k Views Asked by At

On Windows I can connect to a specific Wifi using:

netsh wlan connect ssid=SSID1

The command iwconfig doesn't work on Android. The command svc wifi enable just turns the Wifi on. Is there a terminal command for Android that connect to a specific Wifi? I'm using a rooted Cyanogenmod 13.

2

There are 2 best solutions below

0
xDantehh On

Try installing the Kali Linux overlay for Android if it's availible for your phone. It supports the iwconfig command and can connect to (password protected) wifi networks via the Nethunter Terminal.

0
BartBugDev On

If you want to simply connect to WiFi - you can use Termux only.

This video can help installing Termux on your Android phone: https://youtu.be/-oE8_bXVn4M

In Termux:

Enabling WiFi:

TERMUX-wifi-enable

Search available networks:

TERMUX-wifi-scaninfo

Connect to WiFi:

TERMUX-wifi-connect [SSID] [encryption type (none|wep|wpa|)] [key]