DEV Community

Bijay Kumar Pun
Bijay Kumar Pun

Posted on

Linux Test Session: Listing hardware device with $ls*

$lshw

List hardware

$lsblk

List block devices
[There are two types of devices; block and character. Block devices reads data in chunks while character devices reads in character ]

$lsusb

List usb devices

Combine to $less for better control

Eg: $lshw | less

When a new device is connected but not recognized:

  1. Check if the device is listed in /dev/
  2. Count the listing before and after the device is connected *$ls /dev/ | wc -l This gives word count that should be different when new device is detected

Alt Text

When a 4gb memory card was inserted


$dmesg

This generally tells what's happening.
(kernel ring buffer)

https://askubuntu.com/questions/285539/detect-and-mount-devices


Other ways to know about devices

dmesg
sudo fdisk OR sudo fdisk -l
sudo blkid
lsblk
mount
lsusb
usb-devices
df -h
Enter fullscreen mode Exit fullscreen mode

Top comments (0)