Raspberry Pi

Raspberry Pi Commands to Check Connected Devices

Do you really want to control your Raspberry Pi devices? Using the main desktop is easy for you but a time may come when you have to rely on the command line so it’s a good opportunity and a great learning experience for you if you get to know about most of the commands on Raspberry Pi.

You are already familiar with the Raspberry Pi device and you know how many ports are there in the device. But, do you want to know how to get information about devices on each port of Raspberry Pi? Yes, this looks to be quite a hectic task and you are looking for a solution that will provide you with the list of devices connected to your Raspberry Pi. In this article, you will find an easy solution which will help you to check the connected devices on Raspberry Pi.

Raspberry Pi commands to check connected devices

Here, you will learn about some commands which will help you to check the connected devices on your Raspberry Pi device. If you are interested in finding the information of connected devices on Raspberry Pi, then you will need to look at the below simple commands and you will have to enter them on your Raspberry Pi terminal to get the required information of the devices.

1: Getting the list of all attached USB devices on Raspberry Pi

If you want to get the list of all attached devices on your current Raspberry Pi device, the below mentioned command will provide you the required information.

$ lsusb

When you press Enter after typing the above command the terminal you will get the result as shown in the image below.

There is another command which you can also use to get the information about the attached devices on your Raspberry Pi.

$ lsblk

2: Checking the list of Partition of an SD card on Raspberry Pi device

You already know that SD card is used as a hard drive on a Raspberry Pi device where your operating system is installed and you don’t know about the partitions on your device SD card. But don’t worry, if you enter the below mentioned command in the terminal, it will provide you with the list of partitions of an SD card on your Raspberry Pi device.

In order to find the name of your SD card, first you will have to use the below mentioned command which will show you the name of your SD card.

$ lsblk

Next, you will have to use the below command in the terminal to get the list of partitions on your SD card.

$ ls /dev/mmcblk0*

It is to be noted that you have to replace the name “mmcblk0” with your SD card name don’t use the same name as given above in the terminal.

If you are using a hard disk with your Raspberry device, you can replace the “sda” with “hda” to view the list of partitions on your hard drive. The command will look like this as shown below.

$ ls /dev/[hda_name]*

Conclusion

Getting the information of connected devices is only possible when you use the commands mentioned above in your Raspberry Pi terminal. Whether the information is about getting the partition list on the SD card or displaying the list of attached USB devices on your Raspberry Pi device, you will need those commands mentioned in this article.

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.