Raspberry PI Commands to check connected devices

Raspberry PI Commands to check connected devices


Explore the power of Raspberry Pi by mastering essential commands to inspect connected devices! Our blog delves into the basics with an Introduction, guiding you through the intricate world of USB devices using 'lsusb.' Discover the art of auditing mounted drives and filesystems, unraveling your Raspberry Pi's hardware secrets. Dive into the heart of hardware interactions and events through the Linux /proc/ filesystem. Concluding with key takeaways, this blog empowers you to navigate your Raspberry Pi's ecosystem with confidence. Unleash the potential of your tiny computer today!


The Raspberry Pi is a versatile single-board computer with a myriad of uses for DIY tech projects, media centers, network appliances, and more. As the Pi supports various methods for attaching additional devices through its GPIO pins, USB ports, wired networking, Bluetooth, and WiFi connectivity - users will likely want to interface it with everything from keyboards and mice to external hard drives and wireless peripherals.

Having the ability to clearly identify connected devices to your Raspberry Pi is crucial for effectively developing and maintaining projects built around the Pi. Whether you need to troubleshoot why a device isn't working, check for free space on attached storage drives, ensure the right peripherals are communicating with the board on startup, or closely monitor hardware access and events - there are a range of Linux terminal commands that provide detailed insight into connected device information and activity on this single-board computer.

Read on as we cover several highly utilitarian commands for checking connected USB and integrated devices on the Raspberry Pi. These will help you more deeply understand the breadth of your Pi's connectivity and how to parse the critical details.

Examining Attached USB Devices In-Depth with lsusb

The lsusb terminal command lists details on USB devices connected to the Raspberry Pi, whether through the Pi's onboard USB ports or an attached USB hub. Used without any options or arguments, lsusb provides a brief overview of connected USB device identities, displaying each device on a separate line including assigning a "bus" and "device" number. For example:


Bus 001 Device 004: ID 04f2:b307 Chicony Electronics Co., Ltd 
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

This output indicates there are currently 4 USB devices attached to the Raspberry Pi. Each one is mapped to the root USB hub controller under its own unique bus and device numbering scheme.

To garner more verbose and descriptive info on the USB products connected to the Pi, utilize lsusb with the "-v" parameter to produce multi-lineVerbose Output detailing the USB device descriptors:


lsusb -v 
Bus 001 Device 004: ID 04f2:b307 Chicony Electronics Co., Ltd 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x04f2 Chicony Electronics Co., Ltd
  idProduct          0x0489 
  bcdDevice            2.11
  iManufacturer           1 KYE Systems Corp.
  iProduct                2 HP Basic USB Keyboard
  iSerial                 0 
  bNumConfigurations      1

Now there is expanded info like the vendor ID, product ID, USB spec level supported, maximum packet size for the default endpoint zero, and descriptive strings for the manufacturer name, product name, and serial number - in this instance showing a basic HP-branded USB keyboard attached to our Pi.

Running lsusb with its "-t" option will generate a handy Tree Output view that presents the USB device connection hierarchy across controllers, hubs, and devices in an properly indented layout for easy understanding:


lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=musb-hdrc/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 3, If 0, Driver=smsc95xx, 480M
        |__ Port 3: Dev 4, If 0, Driver=usbhid, 1.5M

In this structured view, you can clearly identify that our Raspberry Pi's root USB hub controller is connecting through a second USB hub device, with the Ethernet adapter on one port and USB keyboard on another downstream port of that hub. Taking the time to routinely view your Pi's USB configuration in this manner enables you to verify device associations and available bandwidth, as well ensure the expected devices appear at startup.

read more : How to work with Raspberry pi remotely

Auditing All Mounted Drives & Filesystems on the Raspberry Pi

Beyond externally connected peripherals themselves, users will often attach complete USB storage devices to the Raspberry Pi such as portable hard drives and flash media. The df command provides a quick report detailing all currently mounted drives and filesystems visible to the Raspberry Pi, including any externally attached storage.

Used by itself, df shows the filesystem device identifiers, total size, used space, available free space, capacity percentage utilized, and where each is mounted:


Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/root        1436052  133932  1242136  10% /
devtmpfs          475708       0   475708   0% /dev
tmpfs             485376       0   485376   0% /dev/shm
tmpfs             485376    8504   476872   2% /run
tmpfs               5120       4      5116   1% /run/lock
/dev/mmcblk0p1    258095   14927   243168   6% /boot

This provides a comprehensive overview of the storage volumes directly available to the Pi, spanning its primary OS filesystem, memory-based tmpfs volumes, and the boot partition on the microSD card where the Pi OS image resides.

To filter df command output to just show details on externally attached non-root volumes, pass the "-h" parameter to produce human readable file sizes and pipe to the grep command to filter for "/media" mount point prefixes typically used for attached drives:


df -h | grep /media  
/dev/sda1        457G   33M  457G   1% /media/pi/EXTERNAL_DRIVE

Now the extraneous system volume entries are removed, allowing you to validate that your attached USB hard disk mounted properly with the correct size and availability. Carefully monitoring disk utilization over time will ensure you have adequate capacity for the data generated by your projects and applications running on the Raspberry Pi.

Examining The Raspberry Pi's Hardware Configuration Profile

While lsusb helps identify USB devices, to procure a complete hardware profile inventory - including details on the Pi board itself as well as integrated input devices, storage, graphics, networking, and more - employ the lshw command.

In its default standard output mode, lshw produces lengthy multi-page output displaying the Linux hardware description tree:



rpi ~$ lshw  
    description: Computer  
    width: 64 bits  
       description: Motherboard
       physical id: 0  
          description: System memory
          physical id: 0
          size: 944MiB
          product: ARMv7 Processor rev 4 (v7l)
          vendor: ARM
          physical id: 1
          bus info: cpu@0
          size: 700MHz
          capacity: 700MHz
          description: USB controller
          product: VL805 USB controller

This exposes very comprehensive details on each piece of hardware detected within the Pi system, spanning everything from the ARM processor model and clock speed to the video core GPU, mass storage identifiers, USB controllers, wireless circuitry, and more. To instead view a brief high-level hardware summary, use lshw with "-short" parameter:


lshw -short  

H/W path       Device      Class       Description
                            system      Raspberry Pi 4 Model B 
/0/100                          bus       Raspberry Pi 4 SDRAM
/0/1000                        memory     LPDDR4 SDRAM

This truncated view provides quick confirmation of integrated hardware components without an overwhelming level of detail. The hierarchical device paths plainly lay out the association between connected memory chips, controllers, buses, and the Pi 4 motherboard itself.

Parsing Hardware Interactions & Events In Linux /proc/ Filesystem

Beyond querying hardware state with utilities like lsusb and lshw discussed above, the proc pseudo-filesystem provides a window into kernel managed device interactions in real-time. The /proc directory surfaces system information dynamically from the Linux kernel, without a persistent backing store.

So monitoring the /proc filesystem enables you to observe hardware events as they occur on your Pi:


watch -n 1 'ls -l /proc/bus/input/devices'

Every 1.0s: ls -l /proc/bus/input/devices  

total 0 
crw-rw---- 1 root input 13, 64 Dec 21 15:02 event0  
crw-rw---- 1 root input 13, 65 Dec 21 15:02 mice
crw-rw---- 1 root input 13, 63 Dec 21 15:02 mouse0

This live view of /proc/bus/input/devices shows new mice and other input devices as they are connected and disconnected from the Pi's USB ports, using the "watch" command to rerun the ls command every 1 second to capture state changes.

Similarly, stripping away the root hub controller, you can monitor just changes to downstream USB devices:


watch -n 1 'ls -l /proc/bus/usb/001/'

Every 1.0s: ls -l /proc/bus/usb/001/ 

total 0
dr-xr-xr-x 2 root root 0 Dec 21 15:12 001  
dr-xr-xr-x 2 root root 0 Dec 21 15:12 002

Here the /proc enumeration of USB bus 001 which represents the USB controller directly on the Pi board is inspected once a second, showing new device connection entries appearing as USB peripherals are attached.

This method can even enable detailed debugging by matching USB device log entries in /var/log/messages to a monitored device stubs within /proc/bus/usb numbered directories.


The Raspberry Pi is often the centerpiece of electronic projects that involve a menagerie of USB and integrated peripherals, external storage drives, sensors collecting field data, and other attached components. Without visibility into the identity, connectivity associations, and live activity of these devices - troubleshooting issues, ensuring data is flowing to the right locations, and understanding bandwidth usage would prove extremely difficult. Hopefully, this overview gives you a head start on precisely monitoring your Pi's hardware environment. Leveraging these detailed Linux commands within your administration scripts and applications will take your Raspberry Pi projects to the next level!

Components and Supplies

You may also like to read

Frequently Asked Questions

1. How to connect raspberry pi to laptop?

Connecting a Raspberry Pi to your laptop is quick and easy. All you need to do is first purchase the necessary hardware for the connection, such as an Ethernet cable or WiFi dongle depending on what type of network you will be using. Then make sure that both devices are powered up so they can detect each other over the same network. You will then open your Raspberry Pi's settings menu where you should find SSH (Secure Shell) options - this allows users to access another computer remotely through command line interface. Once activated, follow instructions from your operating system’s terminal window in order connect directly with any machine connected via wired or wireless networking and establish an encrypted communication channel between them - it’s secure! With everything set-up correctly, within minutes users can enjoy full remote control of their Raspberry PI environment right from their home computing device – perfect for editing code, analytics data analysis projects and much more!

2. How to connect raspberry pi to laptop using ethernet?

Connecting your Raspberry Pi to a laptop with Ethernet cable is an easy task. The first step involves connecting the two devices using an appropriate ethernet cable and port on each device. Once connected, you can configure networking on both ends of the connection—on your computer's operating system as well as for the Raspberry Pi itself via its settings panel or interface (raspi-config). You will then need to specify information such as IP addresses, subnets, gateways etc., depending upon how you wish to set up communication between each machine. Finally save these changes and after few seconds network setup should be complete allowing access from either end over LAN!

3. How do i connect my raspberry pi desktop to remote desktop?

Connecting your Raspberry Pi desktop to a remote desktop is straightforward and effortless. First, you will need to download the necessary software on your remote computer. Once that’s done, log in with an account for secure access before setting up any port forwarding protocols or IP addressing details from both ends of the linkup. After this has been completed successfully, assign a username and password for authentication purposes then set up VNC server so as to enable communication between devices and securely transfer files back-and-forth respectively due to their established connection point between two networks (local/remote). Finally establish desired functionalities such as accessing cameras connected remotely through another device - thereby allowing greater flexibility over long distances if required!

4. How do i connect vnc viewer to raspberry pi?

To connect VNC Viewer to Raspberry Pi, you need a few key elements. Firstly, ensure that your Raspberry Pi is properlynetworked and powered up. Secondly, install the VNC Server software on your Pi via an SSH connection- this will allow access from any other computers connected to it in order for control of the PI's command line interface remotely over IP networks. After installing the server package make sure that service ports are correctly port forwarded if needed (depending on network layouts). Thirdly configure authentication settings - password or public/private keys – so only authenticated users can gain access into the system securely Then finally launch 'VNC viewer' application which should prompt you for credentials where after successful login; you'll be able to view display output off of raspberry pi as well as interact with mouse & keyboard inputs directly through Vnc Viewer interface window!

5. How do i connect raspberry pi to device?

Connecting Raspberry Pi to a device is simple and straightforward. First, the micro-USB power supply must be connected and then your HDMI cable plugged into the monitor or TV where you want to display video output. Then connect an Ethernet cable from your router if setting up Wi-Fi isn't viable for you or plug in any other USB accessories like a keyboard and mouse so that control of the RPi can take place. Finally, download Raspbian as it will serve as our operating system which we'll also need an SD card (4GB minimum) & flash drive for installation beforehand - this way when everything's installed on one device such extra hardware won't be needed anymore!

6. How do i connect raspberry pi to vnc?

Connecting Raspberry Pi to VNC is simple. First, install theRealVNC software on your computer and configure it for connection with Raspbian OS (Raspberry Pi’s default operating system). Next, make sure access from remote systems is enabled in settings of RPI through its IP address or Server hostname. Lastly, use RealVNC Viewer to connect the two devices together using either a direct IP connectivity method which requires inputting an external Ip Address or via Cloud Connect where you will need your My RealVNC account credentials as well as server authentication details provided by RaspberryPi admin/owner prior connecting both parties securely over internet networks without compromising user data privacy along the way.

7. How do i connect my raspberry pi to my router?

Connecting your Raspberry Pi to a router is simple. First, you need to connect the Raspberry Pi with an Ethernet cable by connecting one end of the cable into the port on the back of your pi and another end into an available LAN port in your home or office router. Next, turn-on both Router and Raspberry pi and check if it is connected successfully using 'ifconfig' command for Linux/UNIX users or following network configuration instructions according to their OS (Windows / Mac). Finally make sure that DHCP server option is enabled for automatic IP address allocation if you are unaware about static IP addresses otherwise use static ipaddress given as per subnet mask configured from local area connection properties window -IPv4 settings tab -Manual.

8. How to connect to raspberry pi over ethernet?

Connecting to a Raspberry Pi over Ethernet is simpler than you might think. To get started, plug an Ethernet cable into the back of your Raspberry Pi and connect it directly to the router or switch. If this direct connection isn’t possible, then use a network adapter that can be connected either via USB or Wireless connections depending on what equipment you have available. Once plugged in correctly, open up the Network configuration options through ‘Preferences' > 'Networking'. From here select Ethernet from dropdown menu and click Apply for changes to take effect. You are now ready explore all possibilities with your new setup within seconds!

9. How do i connect devices to my raspberry pi?

Connecting devices to a Raspberry Pi is an easy process. To begin, you will need the proper cables and adapters necessary for your device(s). Next, depending on which type of connection method you are using (e.g., HDMI or USB), plug in one end into the appropriate port on both your device as well as the Raspberry Pi board itself. Finally, follow any other setup procedures that may be required before it’s ready to use; once properly set up though everything should work without issue! With just a few simple steps you can leverage all available functionality with confidence knowing that each item has been securely linked together so changes won't cause unexpected results down the line - allowing everyone involved to rest assured our system runs optimally no matter what future updates occur within either ecosystem!

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.

Components and Supplies

You may also like to read