Is it possible to access wifi using command line?
I'm using the latest debian-based linux kali Maybe it is an XY problem , as the main problem is after I log in to the system I get a blank screen and mouse pointer. Someone recommends me to change the window manager on the internet
I'm unable to do this because i'm not connected to wifi
I found tutorial how to do this here
And I tried to do it step by step, but it doesn't work for me.
In that tutorial that author wrote that I need use the command ip link set wlan0 ip to bring up the wifi interface. In his example the output looks like this:
root@kali:~# ip link show w
lan0 4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN mode DORMANT qlen 1000
  link/ether 00:60:64:37:4a:30 brd ff:ff:ff:ff:ff:ff
root@kali:~# ip link set wlan0 up
root@kali:~# ip link show wlan0
4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT qlen 1000
    link/ether 00:60:64:37:4a:30 brd ff:ff:ff:ff:ff:ff
On the other hand when i call.
   ip link set wlan0 up
   ip link show wlan0
I understand
  4: wlan0: <NO_CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT qlen 1000
   link/ether 00:60:64:37:4a:30 brd ff:ff:ff:ff:ff:ff
and after running wpa supplicant with valid network details
wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf
iw wlan0 link  still returns Not connected.
What should i do next to solve this problem?
I'm assuming wpa_supplicant  and iw  is installed.
- To connect to wifi through - wpa_supplicantyou need to create a- wpa_supplicant.conffile- nano /etc/wpa_supplicant.conf- with the following lines. - network={ ssid="wifi_name" psk="wifi_key" }
Or you can use wpa_passphrase  to create the configuration file (copy and past).
wpa_passphrase "Your_SSID" Your_passwd
Also you can write the wpa_supplicant.conf  directly through.
wpa_passphrase "Your_SSID" Your_passwd > /etc/wpa_supplicant.conf
to connect type the following command.
sudo ip link set wlan0 down
sudo ip link set wlan0 up
sudo wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant.conf -Dnl80211,wext
sudo dhclient wlan0
Note : Multiple comma separated driver wrappers in option
-Dnl80211,wextmakes wpa_supplicant use the first driver wrapper that is able to initialize the interface (see wpa_supplicant(8)). This is useful when using mutiple or removable (e.g. Usb) wireless devices which use different drivers.
You can connect through wpa_supplicant  without wpa_supplicant.conf  file.
wpa_supplicant -B -i wlan0 -c <(wpa_passphrase "Your_SSID" Your_passphrase) && dhclient wlan0
You can visit the official documentation of Arch-linux to get more information about the configuration file and arguments.
- you can connect through - nmcli- nmcli d wifi connect Your_SSID password Your_Psswd_here ifname Your_interface
Example.
nmcli d wifi connect MYSSID password 12345678 ifname wlan0
- Also you can connect through wpa_cli:
Open the terminal and type wpa_cli
If you want to check type
scan
scan_results
Create a network
add_network
This will output a number, which is the network ID, for example 0
Next, we need to set the SSID and PSK for the network.
set_network 0 ssid "SSID_here"
set_network 0 psk "Passphrase_here"
Once the wireless has connected, it should automatically get an IP address.
if it doesn’t you can run the dhclient to  get an IP address via DHCP.
The dhclient  command ca be replaced with 2 ip  commands.
ip addr add IP-ADDRESSE/24 dev wlan0
ip route add default via ROUTE
- iwctlcommand line tools.
The iwd   package provide the iwctl  command line tools . The package isn't installed by default To avoid any conflict the wpasupplicant.service  should be stopped/disabled.
for more details see this answer on U&L: Connect to wifi from command line on linux systems through the iwd (wireless daemon for linux)
Further reading :