The iwconfig command in Linux is similar to ifconfig command but instead of configuring all types of network interfaces, it is used specifically to display and configure different parameters of a wireless network interface. For example, you can configure the SSID, frequency, and password, or encryption type of a wireless network.
In this article, I will discuss iwconfig command and its usage in a Linux system.
Syntax of iwconfig command in Linux
iwconfig [interface] [options]
Where interface
is the name of the wireless network interface and you can find a list of detailed options that can be used with the iwconfig on its man page.
Usage of iwconfig command in Linux
When iwconfig is used without any arguments it will display all the wireless network interfaces on a system.
For example –
iwconfig
You can see the output in the given image –
Change ESSID of a wireless network
To set ESSID or network name or domain id you can use the following command in your terminal –
sudo iwconfig wlp1s0 essid "wifi1"
Where wlp1s0
is the name of the wireless network interface and we are setting its name to “wifi1
“.
Set Network ID
The nwid option is used to set the network id on/off. This function is used only for wireless network hardware before the 802.11 standards.
sudo iwconfig enp2s0 nwid on/off
Set nickname for a wireless network
By using the given command you can set the nickname for a wireless network.
For example –
sudo iwconfig wlp1s0 nickname "mywifi"
Set mode of operation of a wireless network
For a wireless network, the mode of operation could be Ad-Hoc, Managed, Master, Repeater, Secondary, and Monitor. Use the following command to change the operating mode –
sudo iwconfig wlp1s0 mode Ad-Hoc
Set operating frequency or channel
The following command will set the operating frequency and channel in the wireless network device.
sudo iwconfig wlp1s0 freq 5.0
Similarly to set channel use –
sudo iwconfig wlp1s0 channel 2
Please don’t forget to replace the wlp1s0
with the correct interface name on your system.
You can get more information about the usage of this command by visiting its man or help page.
Now use –
man iwconfig
OR –
iwconfig --help
Conclusion
Ok, so I hope now you understand how to use iwconfig command in Linux. Now if you have a query then write us in the comments below.