4

UPD: Changed question title from manage devices to discover information about devices

One of the frequent thing I do is look up info about devices on my systems. And I am constantly find myself confused about various different commands on Linux to query available disks, network adapters, graphics cards etc.

For example, if I need to query all disk drives available, I do:

ls -la /dev/disk/by-id

If I need to query all network cards available, I do:

ls -la /sys/class/net

Is there any single point to query all device ids by type?

Maybe there was initiative to unify handling of devices info and make it discoverable/accessible, but it failed?

History of the question in order of appearance:

  1. /dev/disk/ lists disks, why /dev/net/ doesn't list network interfaces?
  2. Why are network interfaces not in /dev like other devices?
  • there is now on most linux distro the command lspci lsusb and so on that allow a nice listing. But I don't thing there anything working everywhere. – Kiwy Dec 18 '13 at 09:12
  • 3
    Your main issue is also one of mine: network interfaces not having entries in /dev, thus being among the few devices that break the Unix file paradigm. It messes with my Chi, man. (and my OCD) – Alexios Dec 18 '13 at 10:38

2 Answers2

3

I think you are looking for hwinfo command. This command helps you to query disk, network and other hardware information

SHW
  • 14,786
  • 14
  • 66
  • 101
3

There is no single standard or tool to query hardware devices on Linux systems in general. Depending on your host's architecture, and which of its components you must query, and how much detail you need about it, you may need one or more tools specific to that component. However some commands/tools are in wider use and have greater mindshare than others. Following are some--that may or may not be available for your particular host--but are nonetheless Generally Regarded As Useful and widely available from major package managers (though I only link to Debian below):

all-purpose query tools:

tools for specific subsystems:

  • dmidecode - processor, memory and motherboard details from BIOS
  • lscpu - processor details from /proc/cpuinfo
  • lspci - PCI devices, typically graphics cards, audio cards, network cards
  • lsusb - USB devices in general
  • ls -l /dev/disk/by-{id,label}/ - block devices and their block device files
  • ls -l /sys/class/net/ - network devices and their network interfaces
  • udevinfo - block devices, if using udev

I encourage people to expand this list if some essential tool is missing.

TomRoche
  • 1,285