Troubleshoot your WiFi connection with this simple command line method

A step-by-step guide for checking and verifying that your Raspberry Pi is connected to the desired WiFi network using the command line. …


Updated August 11, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


A step-by-step guide for checking and verifying that your Raspberry Pi is connected to the desired WiFi network using the command line.

Checking if WiFi is Connected on a Raspberry Pi

If you are having issues with your Raspberry Pi connecting to a WiFi network, it can be helpful to check whether or not it is actually connected. This can be done by running a few simple commands in the terminal. Follow these steps:

  1. Open the terminal on your Raspberry Pi by clicking on the “Terminal” icon in the top menu bar or pressing Ctrl + Alt + T.
  2. Type the following command and press Enter:
sudo iwconfig

This will display information about all the wireless network interfaces on your Raspberry Pi. Look for a section that starts with “wlan0” (or “wlan1” if you have more than one WiFi adapter). If you see an “Access Point” listed under wlan0, it means that your Pi is connected to a network:

wlan0     IEEE 802.11bgn  ESSID:"your_network_name"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.437 GHz  Access Point: XX:XX:XX:XX:XX:XX  
          Bit Rate=1 Mb/s   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=69/70  Signal level=-41 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:1283   Missed beacon:0

If there is no “Access Point” listed, your Pi is not connected to a WiFi network. You can try connecting again using the following command:

sudo iwlist wlan0 scan | grep ESSID

This will list all available WiFi networks in range. Look for the name of your desired network and connect using these commands (replace “your_network_name” with the actual name):

sudo ifconfig wlan0 down
sudo iwconfig wlan0 essid your_network_name
sudo ifconfig wlan0 up
  1. Next, check your IP address by running:
ifconfig wlan0

Look for the “inet addr” field to see your assigned IP address (it should look something like 192.168.1.100). If you don’t see an IP address, it means that your Pi is not connected or has not been assigned one by the router:

wlan0     Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:34 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6512 (6.3 KiB)  TX bytes:966 (966.0 B)
  1. If you still can’t connect, make sure that your WiFi dongle is working properly by plugging it into a different USB port or trying a different one altogether. You may also need to update your Raspberry Pi’s firmware with:
sudo rpi-update

If none of these steps work and you are still having issues connecting, consider seeking help from the community forums or asking a professional for assistance.