I want to write a script-Ubuntu_OS- would connect to a wireless Internet so I need to know how to connect Internet via terminal in Linux. I tried many suggestions on the Internet but nothing at all
By your question i assume you want a script to connect to a wi-fi network using a linux script and access internet.
Scan all networks available
iwlist wlan0 scan
Cell 14 - Address: 80:A1:D7:7A:5E:68 <<AP Channel:6 Frequency:2.437 GHz (Channel 6) Quality=26/70 Signal level=-84 dBm Encryption key:on ESSID:"ra" Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s 36 Mb/s; 48 Mb/s; 54 Mb/s Mode:Master Extra:tsf=000000003621716c Extra: Last beacon: 1260ms ago IE: Unknown: 000472686561 IE: Unknown: 010482848B96 IE: Unknown: 030106 IE: WPA Version 1 Group Cipher : TKIP Pairwise Ciphers (1) : TKIP Authentication Suites (1) : PSK IE: Unknown: 050400010000 IE: Unknown: 2A0104 IE: Unknown: 32080C1218243048606C
From the list select essid of wi-fi netwwork you want to connect
iwconfig wlan0 essid ID key KEY
if ESSID is "" use access-point
iwconfig wlan0 ap AP key KEY
#!/bin/bash ifconfig wlan0 iwconfig wlan0 ap AP key KEY dhclient wlan0
You could try using WICD network manager, it has a CLI network manager you can install.
You could also try using the Ceni script from smxi, which has worked great for me in a few cases where WICD and Gnome-network-manager were not working.
These won't really be a script to start a network connection, but both are accessible from command line and both will let you scan for networks, connect, put in keys, etc. in a nice manner.