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 9: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

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.

| improve this answer | |

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

| improve this answer | |
  • I was actually looking for a location on a filesystem where I can query all this info with ls -la. I don't dare running hwinfo inside my server processes. – anatoly techtonik Dec 18 '13 at 14:27
  • 1
    @techtonik Mind you, that not everything has a file representation that can be queried by opening and reading. – user13742 Dec 18 '13 at 16:07
  • @HermanTorjussen, for instance? – anatoly techtonik Dec 18 '13 at 19:23
  • @techtonik For instance information about the motherboard. – user13742 Dec 18 '13 at 19:44
  • @HermanTorjussen, why there is a problem to provide /dev/motherboard/model and other user level fields? – anatoly techtonik Dec 19 '13 at 3:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.