How can I find the hardware model in Linux?

379,337

Solution 1

using the dmidecode | grep -A3 '^System Information' command. There you'll find all information from BIOS and hardware. These are examples on three different machines (this is an excerpt of the complete output):

System Information
    Manufacturer: Dell Inc.
    Product Name: Precision M4700

System Information
    Manufacturer: MICRO-STAR INTERANTIONAL CO.,LTD
    Product Name: MS-7368

System Information
    Manufacturer: HP
    Product Name: ProLiant ML330 G6

Solution 2

Try sudo dmidecode -t baseboard for full information on the DMI table contents relevant to your baseboard, in a human readable form. For just the System Product Name, you can use either (type dmidecode -s to get a list of strings keywords):

sudo dmidecode -s system-product-name
sudo dmidecode -s baseboard-product-name

Other relevant options for motherboard info are

sudo dmidecode -s system-version
sudo dmidecode -s baseboard-version
sudo dmidecode -s system-manufacturer
sudo dmidecode -s baseboard-manufacturer

Try sudo dmidecode -s for a full list of system DMI strings available.

Solution 3

For the record, much of this information is available under /sys/devices/virtual/dmi/id on modern Linuces (ie, since at least 2011), and much if it- notably, not including serial numbers- is readable by regular users. To answer the original poster's question, product_name is the file that contains the system's model name.

bios_date
bios_vendor
bios_version
board_asset_tag
board_name
board_serial
board_vendor
board_version
chassis_asset_tag
chassis_serial
chassis_type
chassis_vendor
chassis_version
modalias
power
product_name
product_serial
product_uuid
product_version
smbios_version
subsystem
sys_vendor
uevent

And here would be a handy-dandy script that any user could run, to display the goodness:

#!/bin/bash

cd /sys/devices/virtual/dmi/id/
for f in *; do
        printf "$f "
        cat $f 2>/dev/null || echo "***_Unavailable_***"
done

No filenames have spaces in them, so this information is easily manipulated by utilities such as awk, for your own nefarious purposes!

Solution 4

On modern Linux systems, you can easily do things like this as any user:

cat /sys/devices/virtual/dmi/id/sys_vendor

cat /sys/devices/virtual/dmi/id/product_name

This also works well for CoreOS, which does not ship with dmidecode.

Note: This has been mentioned in other answers/comments, but is hopefully more visible here, as this is a much easier method than using dmidecode.

Solution 5

Everyone here talks about the great dmidecode command and the -t parameter, but with sudo lshw -short you also get easily the product name and model:

$ sudo lshw -short
H/W path       Device     Class          Description
====================================================
                          system         UX303UB (ASUS-NotebookSKU)
/0                        bus            UX303UB

Other great commands for getting hardware info:

  • inxi [-F] All-in-one and friendly, written in Perl. Try inxi -SMG -! 31 -y 80
  • lscpu # Better than /proc/cpuinfo
  • lsusb [-v]
  • lsblk [-a] # Better than df -h. Block Device Information.
  • sudo hdparm /dev/sda1
Share:
379,337

Related videos on Youtube

Eduard Florinescu
Author by

Eduard Florinescu

Updated on September 18, 2022

Comments

  • Eduard Florinescu
    Eduard Florinescu over 1 year

    I used a system information utility to take the model number of a system, and also of the motherboard.

    DMI System Manufacturer     LENOVO
    DMI System Product          2306CTO
    DMI System Version          ThinkPad X230
    DMI Motherboard Product     2306CTO  
    

    Is there a way to get model number, in this case 2306CTO, in Linux?

    • Sergey
      Sergey about 11 years
    • Bratchley
      Bratchley about 11 years
      For clarity it seems you're interested in hardware product, not specifically the motherboard. For example, "ThinkPad X230" is a type of computer not motherboard.
    • Blake Russo
      Blake Russo over 5 years
      You can also get some info without extra packages by running dmesg command or checking /var/log/dmesg* .
    • Time4Tea
      Time4Tea about 4 years
      It would be nice to know what 'System Information Utility' you used.
  • eppesuig
    eppesuig about 11 years
    @JoelDavis, I was not aware of those options before. I will use them. Thanks.
  • Eduard Florinescu
    Eduard Florinescu over 9 years
    Great, that's great with linux-based most of the if you don't find a tool the stuff you need (OS, hardware info) is somewhere in /sys or /proc. Thanks
  • qwertzguy
    qwertzguy over 9 years
    Note: needs root. If you want all the info you have permissions for under the current user, use: cat /sys/devices/virtual/dmi/id/* (and it does allow you to get the model name and the sort using a normal user)
  • qwertzguy
    qwertzguy over 9 years
    Awesome! A solution that works for non-root!
  • Mike S
    Mike S about 8 years
    Note that this dmi information may only be applicable to Intel-based PCs. I have a network device that is driven by a Linux-based ARM computer, and neither dmicode or the path in /sys is available to it.
  • cjac
    cjac over 7 years
    Piping the output of dmidecode without arguments to grep is interesting, but not the most efficient means of getting the information. dmidecode can print exactly what the OP is asking for by specifying the 'system-product-name' keyword string: sudo dmidecode -s system-product-name
  • Shadur
    Shadur over 7 years
    Aside from lshw, none of those commands answer the question the OP asks. They're highly useful utilities, yes, but not exactly in the scope of the question...
  • Pablo A
    Pablo A over 7 years
    @shadur why you downvote me? I answer the question in a way any other answer do, and then just offer extra useful information, what is pretty command on any great post.
  • Joshua Detwiler
    Joshua Detwiler almost 6 years
    grep needs quotes.
  • Joshua Detwiler
    Joshua Detwiler almost 6 years
    I think it's worth noting that older systems don't have flags available on dmidecode, nor even a man page. The answer above is the most Linux-portable answer here, I think. The -t and -s flags are useful on newer systems for sure.
  • Mike S
    Mike S almost 6 years
    Looks nice. I'm wondering if there's a way that this tool will return system or board serial numbers? Then you don't need root for just about any system introspection like this. (I'm guessing the answer is "no").
  • Lizardx
    Lizardx almost 6 years
    Prior to a change in the linux kernel, which creates the /sys file system, you could get the serial numbers for these things without being root, but after the change, which is totally outside of inxi's control, you need to be root, and there is no way to work around that. Obviously that was a silly decision and a regression based on some bad idea someone had, but there's nothing inxi can do to resolve that problem. sudo inxi -Mxxx returns serials always. On some systems no sudo is required, depends on the kernel version I think.