DEV Community

Bijay Kumar Pun
Bijay Kumar Pun

Posted on

2

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

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay