Raspberry Pi

How to check Internet connectivity on Raspberry Pi terminal

Regular checking your Internet connectivity on Raspberry Pi is important as this will give you confidence that your internet is running perfectly fine on your device and you can execute several internet-related tasks easily. One of the easiest methods to check the Internet connectivity on your Raspberry Pi is through the desktop WIFI connection. Still, this method won’t work on the lite Raspberry Pi operating system with no GUI. In that case, you are bound to use the terminal to check your internet connectivity.

In this tutorial, we are going to provide you with the information on several important terminal commands to check your Internet connectivity on your device.

How to check Internet Connectivity through Raspberry Pi Terminal

Here, we will see the information of several commands you can execute on your Raspberry Pi terminal to check the internet connectivity on your device. The details of these commands are given below:

1: hostname command

The hostname command is widely used for finding the IP address of your Raspberry Pi device, which can only be accessible if your device is connected to the internet. If the following command provides you with the IP address, your device has an active internet connection.

$ hostname -I

2: iwconfig command

The iwconfig command is dedicated to wireless interfaces and provides information about your wireless connection. You can execute the following terminal command to check the internet connectivity on your Raspberry Pi.

$ iwconfig

From the above command, you will be able to find out the information of Wireless network and data transfer rate that ensures the working of your internet on the device.

3: ifconfig command

The ifconfig command is another mostly used network command that displays the information of all the active network interfaces on your device. You can execute this command to check the internet connectivity on your Raspberry Pi terminal.

$ ifconfig

Scroll down and find the wlan0 option in case you are accessing the network through WIFI.

From the above command, the IP address assigning ensures that your internet connection is active on your Raspberry Pi device.

4: iwlist command

This iwlist command is used to display the detailed information of your network interface and if you want to check your Wireless internet connectivity, you have to issue the following command:

$ iwlist wlan0 scan

It is important to note that the wireless interface may be different in your case and if you want to know about your wireless interface, you can use the “iwconfig”, or “ifconfig” command.

5: ping command

You can also use the ping command on your Raspberry Pi terminal to check your internet connectivity. This command helps to ensure that your internet connection is running perfectly fine on your device if it doesn’t drop any packet. To use this command, you will also need to provide a website address and if it pings successfully, your internet is in working condition.

$ ping <website_address>

You will also need to stop the ping command wherever ever you want using “CTRL+C” keys to get the required information.

Conclusion

Checking the internet connection on your Raspberry Pi device ensures that you can execute your internet-related tasks without worry and is extremely important for an operating system with no GUI. If you are having a problem with the internet, you can use the commands mentioned above to check your internet connectivity through the Raspberry Pi terminal. These commands ensure you will get your required information onto your terminal screen.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.