Post

Determining Attached Hardware and Computer Peripherals

Determining Attached Hardware and Computer Peripherals

Here’s a concise and structured guide for Determining Attached Hardware and Computer Peripherals on Linux, including system components like sysfs, udev, and hardware management tools:


🔍 Determining Attached Hardware and Computer Peripherals


1. 🧠 How Linux Detects Hardware

Linux uses several key components to detect and manage hardware:

ComponentDescription
sysfsA virtual filesystem (usually at /sys) exposing kernel device details.
udevThe device manager for the Linux kernel; dynamically handles device nodes in /dev.
dbusMessage bus system allowing applications and services to communicate, including hardware events.

Example: To view a USB device’s path:

1
ls /sys/bus/usb/devices/

2. 🛠️ Tools to List Hardware Info

CommandPurpose 
lspciLists PCI devices (e.g., graphics, network cards). 
lsusbLists USB devices. 
lsblkLists block devices (disks, partitions). 
lscpuShows CPU architecture details. 
lshwLists all hardware (requires sudo). 
inxi -FxA comprehensive system/hardware report (install with sudo pacman -S inxi or apt install inxi). 
hwinfoDetailed hardware information (may need installation). 
`dmesg | grep`Useful for boot-time hardware detection logs. 
cat /proc/cpuinfoDetailed CPU info. 
cat /proc/meminfoRAM info. 

3. 🔌 Tools to Manipulate USB Devices

  • modprobe: Load or remove kernel modules.

Examples:

1
2
sudo modprobe usb_storage     # Load USB storage module
sudo modprobe -r usb_storage  # Remove it

Check modules:

1
lsmod | grep usb

4. 💽 Manually Mount and Unmount Filesystems

  1. List devices:
1
lsblk
  1. Mount a device:
1
sudo mount /dev/sdX1 /mnt
  1. Unmount:
1
sudo umount /mnt

Make sure the mount point /mnt exists, or create it using mkdir.


5. 🔁 Automatically Mount Filesystems on Boot

Edit /etc/fstab — Format:

1
<device>   <mount_point>   <filesystem_type>   <options>   <dump>   <pass>

Example:

1
UUID=abcd-1234  /mnt/usbdrive  ext4  defaults  0  2
  • Get UUID:
1
blkid

Be careful: Mistakes in /etc/fstab can prevent your system from booting. Test with:

1
sudo mount -a

This post is licensed under CC BY 4.0 by the author.