8

Occasionally I want to check what exact model of hardware component I am using. I don't really care about extreme detail things like what brand of capacitor they used on the Motherboard in position xyz. I just want to know what is the exact model of my motherboard, ram, video card and so on, usually because I'm trying to shop for compatible hardware or look for drivers. So basically all I need is one line per important piece of hardware showing pretty much what the box said that it came in.

How can I do this in Linux from the command line?

What I've tried:

  • neofetch is the best thing I've found but it only shows CPU and GPU. It doesn't say the RAM model or frequency, hard drive model or motherboard model.
  • lshw prints 517 lines of gibberish that I can never make heads or tails out of. This is clearly some kind of technical tool, not something for people that just want to know what models of hardware they have and are too lazy to pop the case and look inside with a flashlight.
3
  • The type of information you want appears to be at the beginning of lshw's output. The head command can be used to only get the first X lines of output from a command. lshw | head -n 15 tells me the model ("product") and manufacturer ("vendor"). It's not as compact/straightforward as inxi described by @Freddy below though.
    – LawrenceC
    Mar 6 at 15:43
  • @LawrenceC It is not, otherwise I would not be asking the question. Interested parties can see the accepted answer for details.
    – Jessica
    Mar 7 at 0:18
  • You could also customize neofetch to display what you want. github.com/dylanaraps/neofetch/wiki/Customizing-Info
    – chicks
    Mar 7 at 19:44

2 Answers 2

16

inxi is another tool of this kind. The default output is only 2 lines, the full output on my machine (-F) has 29 lines, with memory info (-m) a few lines more.
Options -x, -xx and -xxx add more verbose information to each item like vendor:product ID or serial number if you need them.

Screenshots

Try it:

inxi
inxi -Fm
sudo inxi -Fmxx

Standard tools are lspci, lsusb and lscpu if you need information about your hardware.

12

lshw's default output format is, IMO, excessively verbose. You may find the -short output format useful, it's a simple one line per device human-readable summary.

The -json option produces output that is easy to parse unambiguously in a variety of languages - e.g. perl and python have JSON parsing libraries, and you can use jq on the command line or in a shell script to process json data and extract the information you want. See man lshw for details.

Another tool you may find useful is dmidecode. From man dmidecode:

dmidecode is a tool for dumping a computer's DMI (some say SMBIOS) table contents in a human-readable format.

This table contains a description of the system's hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision. Thanks to this table, you can retrieve this information without having to probe for the actual hardware.

While this is a good point in terms of report speed and safeness, this also makes the presented information possibly unreliable.

2
  • The "-short" format for lshw is sometimes a little too concise. For example, it merely notes that I've got an NVME drive, without saying what model it is.
    – Mark
    Mar 7 at 4:25
  • yes. and ls without -l doesn't print the permissions, size, or timestamp. programs often have various options to do different things. lshw's -short option outputs a summary without many details. If you want detailed output, use the default output or the -json option.
    – cas
    Mar 7 at 4:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .