Hardware

How to connect to a wifi network using the terminal

Table of contents:

Anonim

When we have a Linux installation that does not have a graphical environment or a tool for network management, we must use the terminal to connect to a Wifi network, to perform this task there are various procedures, but I particularly consider that the most Simple is using the piwconfig, ifconfig, iwlist and the fundamental nmcli tools.

Index of contents

How to connect to a Wifi network using the terminal

This procedure to connect to a Wifi network using the terminal can be applied to both WEP and WPA networks, it is independent of the distro you are running and works with any network card.

Knowing the tools to use

It is important to note that the tools for this procedure are installed by default in most of the current distros, being its general use the one mentioned below:

  • iwconfig: This tool allows us to view and configure the parameters of a wireless network interface. ifconfig: Allows us to turn on the wireless device. iwlist: Detailed information is obtained from the available wireless networks. nmcli: It is a tool that allows us to control NetworkManager and report the state of the network, giving us the possibility of creating, displaying, editing, deleting, activating and deactivating network connections.

To know in detail the syntax and use of each of these commands, we can execute the command accompanied by the help argument, for example, nmcli -h, which will return a fairly explanatory summary of the scope of each tool and its way of using it..

Procedure to connect to a Wifi network using the terminal

The first thing we must do to connect to any Wi-Fi network using the terminal is to identify the name of our team's network card with the following command:

iwconfig

Once we have the name of the network card, we must proceed to turn it on for them run the following command:

ifconfig up

Next we must analyze the available wireless networks and know the SSID of the same, which can be done easily with iwlist for this we must execute:

sudo iwlist scanning

Having the data of the card and the wireless network to which we want to connect, we simply must run nmcli with the corresponding parameters:

nmcli d wifi connect password iface

With these steps we have already connected to a wifi network using the terminal, we must bear in mind that in the above-mentioned commands we must change the following data for those that correspond:

: The name of the network card

: The SSID of the wireless network to which we want to connect

: The access password to the wireless network in question.

In case we want to connect to a wifi network that is already in our history, all we have to do is run the following command from the terminal:

nmcli c up

We recommend you read the best routers on the market

Once all the previous steps have been carried out, we should be able to properly access the wireless network that we have chosen.

Hardware

Editor's choice

Back to top button